469,641 Members | 1,116 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,641 developers. It's quick & easy.

Problem with subprocess.Popen()

Hi all,

I'm trying to run a windows batch file from a python script using
subprocess.popen().

The issue that I'm facing is that, if i give the batch file as
parameter to the popen function, the script runs, but if i provide a
parameter, it is not working.

Can someone help me with the command.

The actual windows command to be executed is:

test.bat -t ABC_DE_FG_HI_001 "C:\ABCDEFGHIJKLMNOP.TXT"

What is the actual parameter required for subprocess.Popen(parameter
chain) in this case??

Kindly help me out...

Regards and Thanks in advance...
Ashwin Murali.

Aug 1 '07 #1
1 1940
I'm trying to run a windows batch file from a python script using
subprocess.popen().

The issue that I'm facing is that, if i give the batch file as
parameter to the popen function, the script runs, but if i provide a
parameter, it is not working.

The actual windows command to be executed is:

test.bat -t ABC_DE_FG_HI_001 "C:\ABCDEFGHIJKLMNOP.TXT"
do something like:
subprocess.Popen(r'test.bat -t ABC_DE_FG_HI_001
"C:\ABCDEFGHIJKLMNOP.TXT",shell=True)

This is same as doing os.system()

If even this results in any error (post back the error message) and try
setting the executable argument explicit.

subprocess.Popen(r'test.bat -t ABC_DE_001
"C:\ABCD.TXT",executable="test.bat",shell=True )
--
O.R.Senthil Kumaran
http://uthcode.sarovar.org
Aug 1 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Xah Lee | last post: by
2 posts views Thread by Stewart Midwinter | last post: by
reply views Thread by Stewart Midwinter | last post: by
3 posts views Thread by Darren Dale | last post: by
12 posts views Thread by Eric_Dexter | last post: by
9 posts views Thread by Phoe6 | last post: by
12 posts views Thread by bhunter | last post: by
7 posts views Thread by skunkwerk | last post: by
25 posts views Thread by Jeremy Banks | last post: by
1 post views Thread by Mark Shewfelt | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.