[BangPypers] Fwd: Issue with subprocess Module
tarun
tarundevnani at gmail.com
Wed Apr 8 08:21:42 CEST 2009
---------- Forwarded message ----------
From: tarun <tarundevnani at gmail.com>
Date: Wed, Apr 8, 2009 at 10:30 AM
Subject: Fwd: Issue with subprocess Module
To: bangpypers at python.org
---------- Forwarded message ----------
From: tarun <tarundevnani at gmail.com>
Date: Tue, Apr 7, 2009 at 4:34 PM
Subject: Issue with subprocess Module
To: python-list at python.org
Hello All,
I've a batch file to be invoke using a python script. The batch file has
pause, and the time, I need to send some command to the batch file from my
scripts. I placed both, the batch file (test.bat) and the python script
(test.py) in the same folder. And executed 'test.py'
(Please find the source files and error below).
*I get the following error:*
Traceback (most recent call last):
File "<string>", line 74, in run_nodebug
File "D:\test.py", line 4, in <module>
proc = subprocess.Popen(my_bat,stdin=subprocess.PIPE)
File "C:\Python25\lib\subprocess.py", line 588, in __init__
errread, errwrite) = self._get_handles(stdin, stdout, stderr)
File "C:\Python25\lib\subprocess.py", line 717, in _get_handles
c2pwrite = self._make_inheritable(c2pwrite)
File "C:\Python25\lib\subprocess.py", line 746, in _make_inheritable
DUPLICATE_SAME_ACCESS)
WindowsError: [Error 6] The handle is invalid
*Python Script:*
*test.py*
import subprocess,os
my_bat = os.getcwd()+'\\test.bat'
proc = subprocess.Popen(my_bat,stdin=subprocess.PIPE)
input = '\n'
proc.communicate(input)
*Batch File*
*test.bat*
echo "START'
pause
echo 'END'
Please help me with this issue.
Thanks In Advance,
Tarun
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/bangpypers/attachments/20090408/05a12b43/attachment.htm>
More information about the BangPypers
mailing list