How to determine subprocess.Popen() failed when shell=True


P

python

Windows version of Python 2.6.4: Is there any way to determine if
subprocess.Popen() fails when using shell=True?

Popen() successfully fails when shell=False
Traceback (most recent call last):
File "<pyshell#258>", line 1, in <module>
p = subprocess.Popen( 'Nonsense.application' )
File "C:\Python26\lib\subprocess.py", line 621, in __init__
errread, errwrite)
File "C:\Python26\lib\subprocess.py", line 830, in
_execute_child
startupinfo)
WindowsError: [Error 2] The system cannot find the file specified

But when shell=True, there appears to be no way to determine if a
Popen() call was successful or not.

Regards,
Malcolm
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top