Problem with subprocess.Popen()

O.R.Senthil Kumaran orsenthil at users.sourceforge.net
Wed Aug 1 11:15:12 EDT 2007


> 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



More information about the Python-list mailing list