D
Darren Dale
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.Popen(['dir'], stderr=subprocess.STDOUT,
stdout=subprocess.PIPE)
stat = process.wait()
print process.stdout.read()
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Documents and Settings\Darren\Desktop\subprocess_test.py",
line 3, in ?
process = subprocess.Popen(['dir'], stderr=subprocess.STDOUT,
stdout=subprocess.PIPE)#, stdout=PIPE)
File "C:\Python24\lib\subprocess.py", line 533, in __init__
(p2cread, p2cwrite,
File "C:\Python24\lib\subprocess.py", line 593, in _get_handles
p2cread = self._make_inheritable(p2cread)
File "C:\Python24\lib\subprocess.py", line 634, in _make_inheritable
DUPLICATE_SAME_ACCESS)
TypeError: an integer is required
----------------------------------------------------------------------
If I change my script a bit, I get a different error:
import subprocess
process = subprocess.Popen(['dir'])
stat = process.wait()
print process.stdout.read()
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Documents and Settings\Darren\Desktop\subprocess_test.py",
line 3, in ?
process = subprocess.Popen(['dir'])#, stderr=subprocess.STDOUT,
stdout=subprocess.PIPE)#, stdout=PIPE)
File "C:\Python24\lib\subprocess.py", line 542, in __init__
errread, errwrite)
File "C:\Python24\lib\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.Popen(['dir'], stderr=subprocess.STDOUT,
stdout=subprocess.PIPE)
stat = process.wait()
print process.stdout.read()
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Documents and Settings\Darren\Desktop\subprocess_test.py",
line 3, in ?
process = subprocess.Popen(['dir'], stderr=subprocess.STDOUT,
stdout=subprocess.PIPE)#, stdout=PIPE)
File "C:\Python24\lib\subprocess.py", line 533, in __init__
(p2cread, p2cwrite,
File "C:\Python24\lib\subprocess.py", line 593, in _get_handles
p2cread = self._make_inheritable(p2cread)
File "C:\Python24\lib\subprocess.py", line 634, in _make_inheritable
DUPLICATE_SAME_ACCESS)
TypeError: an integer is required
----------------------------------------------------------------------
If I change my script a bit, I get a different error:
import subprocess
process = subprocess.Popen(['dir'])
stat = process.wait()
print process.stdout.read()
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Documents and Settings\Darren\Desktop\subprocess_test.py",
line 3, in ?
process = subprocess.Popen(['dir'])#, stderr=subprocess.STDOUT,
stdout=subprocess.PIPE)#, stdout=PIPE)
File "C:\Python24\lib\subprocess.py", line 542, in __init__
errread, errwrite)
File "C:\Python24\lib\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