1

The entirety of my script:

#!/bin/env python

import subprocess
p = subprocess.Popen(["/bin/bash", "-i", "-c", "C:\\xampp\\xampp_stop.exe"])
stdout, stderr = p.communicate()

This results in: WindowsError: [Error 2] The system cannot find the file specified

However, C:\xampp\xampp_stop.exe does exist

Any suggestions? I'm new to python, so I suspect it's something very, very obvious.

1
  • I guess it can't find /bin/bash. You can Probably just call subprocess.Popen(["C:\\xampp\\xampp_stop.exe"]) - I haven't tested it though. Commented Jun 7, 2012 at 18:26

1 Answer 1

5

It's actually bash that the system can't find. Windows doesn't come with bash. Remove it and its arguments and just call xampp_store.exe.

#!/bin/env python

import subprocess
p = subprocess.Popen(["C:\\xampp\\xampp_stop.exe"])
stdout, stderr = p.communicate()
Sign up to request clarification or add additional context in comments.

2 Comments

Perfect, thanks. (I'm actually using MINGW32, so I thought that would work since bash is available, but your solution does work)
You need to run python from cygwin for that. Otherwise, it won't be able to map /bin/bash to where you installed bash.exe.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.