why does popen2 silently ignore IOError?
graham_guttocks at yahoo.co.nz
Wed Feb 20 02:12:25 CET 2002
Can anyone explain why the popen2 module silently ignores an IOError?
I'm trying to use it to send mail instead of os.popen() to avoid
If all the command-line arguments are proper, things work fine, but if
I open a bogus command-line, popen2 doesn't complain, neither during
the write, nor close. Take the following simple example:
Python 2.1.1 (#1, Aug 13 2001, 19:37:40)
[GCC 2.96 20000731 (Red Hat Linux 7.1 2.96-96)] on linux2
Type "copyright", "credits" or "license" for more information.
>>> import popen2
>>> def sendmail(s):
... args = ['/bin/nonexistent', '-f', 'graham', 'testacct']
... pp = popen2.popen2(args)
As you can see, no exceptions were raised despite the fact that there
is no such file as '/bin/nonexistent'. Why is this?
Do You Yahoo!?
Yahoo! Sports - Coverage of the 2002 Olympic Games
More information about the Python-list