I'm a developer on the matplotlib project, and I am having trouble with the
subprocess module on windows (Python 2.4.2 on winXP). No trouble to report
with linux. I need to use _subprocess instead of pywin32, but my trouble
exists with either option:
import subprocess
process = subprocess.Pope n(['dir'], stderr=subproce ss.STDOUT,
stdout=subproce ss.PIPE)
stat = process.wait()
print process.stdout. read()
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Documen ts and Settings\Darren \Desktop\subpro cess_test.py",
line 3, in ?
process = subprocess.Pope n(['dir'], stderr=subproce ss.STDOUT,
stdout=subproce ss.PIPE)#, stdout=PIPE)
File "C:\Python24\li b\subprocess.py ", line 533, in __init__
(p2cread, p2cwrite,
File "C:\Python24\li b\subprocess.py ", line 593, in _get_handles
p2cread = self._make_inhe ritable(p2cread )
File "C:\Python24\li b\subprocess.py ", line 634, in _make_inheritab le
DUPLICATE_SAME_ ACCESS)
TypeError: an integer is required
----------------------------------------------------------------------
If I change my script a bit, I get a different error:
import subprocess
process = subprocess.Pope n(['dir'])
stat = process.wait()
print process.stdout. read()
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Documen ts and Settings\Darren \Desktop\subpro cess_test.py",
line 3, in ?
process = subprocess.Pope n(['dir'])#, stderr=subproce ss.STDOUT,
stdout=subproce ss.PIPE)#, stdout=PIPE)
File "C:\Python24\li b\subprocess.py ", line 542, in __init__
errread, errwrite)
File "C:\Python24\li b\subprocess.py ", line 706, in _execute_child
startupinfo)
WindowsError: [Errno 2] The system cannot find the file specified
----------------------------------------------------------------------
Can anyone tell me what I am doing wrong?
Thanks,
Darren
subprocess module on windows (Python 2.4.2 on winXP). No trouble to report
with linux. I need to use _subprocess instead of pywin32, but my trouble
exists with either option:
import subprocess
process = subprocess.Pope n(['dir'], stderr=subproce ss.STDOUT,
stdout=subproce ss.PIPE)
stat = process.wait()
print process.stdout. read()
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Documen ts and Settings\Darren \Desktop\subpro cess_test.py",
line 3, in ?
process = subprocess.Pope n(['dir'], stderr=subproce ss.STDOUT,
stdout=subproce ss.PIPE)#, stdout=PIPE)
File "C:\Python24\li b\subprocess.py ", line 533, in __init__
(p2cread, p2cwrite,
File "C:\Python24\li b\subprocess.py ", line 593, in _get_handles
p2cread = self._make_inhe ritable(p2cread )
File "C:\Python24\li b\subprocess.py ", line 634, in _make_inheritab le
DUPLICATE_SAME_ ACCESS)
TypeError: an integer is required
----------------------------------------------------------------------
If I change my script a bit, I get a different error:
import subprocess
process = subprocess.Pope n(['dir'])
stat = process.wait()
print process.stdout. read()
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Documen ts and Settings\Darren \Desktop\subpro cess_test.py",
line 3, in ?
process = subprocess.Pope n(['dir'])#, stderr=subproce ss.STDOUT,
stdout=subproce ss.PIPE)#, stdout=PIPE)
File "C:\Python24\li b\subprocess.py ", line 542, in __init__
errread, errwrite)
File "C:\Python24\li b\subprocess.py ", line 706, in _execute_child
startupinfo)
WindowsError: [Errno 2] The system cannot find the file specified
----------------------------------------------------------------------
Can anyone tell me what I am doing wrong?
Thanks,
Darren
Comment