why does close() fail miserably on popen with exit code -1 ?!

Atanas Banov enterr at gmail.com
Mon Feb 20 01:27:16 EST 2006


i ran onto this weirdness today: seems like close() on popen-ed
(pseudo)file fails miserably with exception instead of returning exit
code, when said exit code is -1.

here is the simplest example (under Windows):

>>> print popen('exit 1').close()
1
>>> print popen('exit -1').close()
Traceback (most recent call last):
  File "<interactive input>", line 1, in ?
IOError: (0, 'Error')
>>> print popen('exit -2').close()
-2

has anyone have idea why is that?

- nas




More information about the Python-list mailing list