Python 2.2.1: os.popen() bug?

Denis S. Otkidach ods at fep.ru
Mon May 27 07:48:33 EDT 2002


On Mon, 27 May 2002, Carsten Gaebler wrote:

CG>
CG> If I write to a pipe that was opened read-only, python
CG> throws an
CG> exception, but then the interpreter hangs instead of
CG> exiting. Is this
CG> beavior expected or a bug? Consider this example on Linux:
CG>
CG> #! /usr/bin/python
CG>
CG> import os
CG>
CG> pipe = os.popen("mail -s Test foo at bar.org")

You have opened pipe for reading, try:
pipe = os.popen("mail -s Test foo at bar.org", "w")

CG> print >> pipe, "Test"  # Raises IOError.
CG> pipe.close()           # Never reached.






More information about the Python-list mailing list