I am trying to call a process from python using subprocess.call as below:
from subprocess import call
exePath = 'C:\\Test\\EXE.exe'
inPath = 'C:\\Test\\IN.in'
outPath = 'C:\\Test\\OUT.out'
call([exePath, inPath, outPath])
This prints a few lines from EXE.exe, followed by an “Invalid handle”, but as a string and not as an error, which makes me think that this could be a message from EXE.exe:
Unzipping Solution...
0.0% The handle is invalid.
However, when I open cmd.exe and insert:
C:\Test\EXE.exe C:\Test\IN.in C:\Test\OUT.out
It works great.
Can someone point me in the right direction?
Thank!
I am running Python 2.7 64-bit on Windows 7.
EDIT:
Now it looks like a problem in PyDev, where the console cannot handle stdout from process rewrite strings. The code works differently from IDLE. Still looking for a fix for PyDev ...
source
share