By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,097 Members | 1,529 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,097 IT Pros & Developers. It's quick & easy.

Problem with subprocess.Popen()

P: n/a
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
Share this Question
Share on Google+
1 Reply


P: n/a
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.