Travis Northcutt
Travis Northcutt

Reputation: 25036

Python: the system cannot find the file specified using subprocess.Popen

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.

Upvotes: 1

Views: 9527

Answers (1)

kichik
kichik

Reputation: 34704

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()

Upvotes: 5

Related Questions