os.popen4 and popen2.popen4 undocumented behavior

Roman Yakovenko roman.yakovenko at actimize.com
Tue Sep 7 00:42:35 EDT 2004


Hi. May be I found bug may be not, but I definitely could not find answer in documentation and GOOGLE.

Environment: Windows XP and  Python 2.3

Description:

I have program that returns negative numbers as errors

int main()
{ return -1; }

>>> import popen2
>>> si, so = os.popen4( r'C:\TEMP\test\Debug\test.exe' )
>>> si.close()
>>> so.close()

Traceback (most recent call last):
  File "<pyshell#15>", line 1, in -toplevel-
    so.close()
IOError: (0, 'Error')
>>> si, so = popen2.popen4( r'C:\TEMP\test\Debug\test.exe' )
>>> si.close()
>>> so.close()

Traceback (most recent call last):
  File "<pyshell#18>", line 1, in -toplevel-
    so.close()
IOError: (0, 'Error')

First of all I don't understand why it makes the difference what is return value
of the process. If main will return non negative number all will work just fine.


Thanks for help.

Roman



More information about the Python-list mailing list