I’m using python to run an external program as follows
call("/usr/sbin/snif")
and I get
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.6/subprocess.py", line 480, in call
return Popen(*popenargs, **kwargs).wait()
File "/usr/lib/python2.6/subprocess.py", line 633, in __init__
errread, errwrite)
File "/usr/lib/python2.6/subprocess.py", line 1139, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
How do I get the last line, that says :
“No such file or directory”
or better yet, how do I know if the execution succeeded or not?
Thanks
You can catch the error:
If you want to see if the command executed correctly, use
check_outputorcheck_callinstead and catch another error: