write to closed console fails on FreeBSD but not Linux?

Jeff Johnson usenet at jeffjohnson.net
Fri Oct 26 10:47:00 EDT 2001


I'm running a Python program as a daemon on FreeBSD 4.3 and Python
2.1.1.  It was crashing just after I would close the console because
printing to sys.stdout after the console was closed produced IO
errors.  I found a few solutions from other usenet posts, I chose to
set sys.stdout and sys.stderr to a file-like class that doesn't write
to anything.

What puzzles me is why Mandrake (8.1 I think, and probably any linux)
doesn't raise exceptions when printing to stdout after the console is
closed.

Is this a problem with Python or just a difference in the two OS's? 
If possible and it makes sense, it would be great if Python did not
raise exceptions from print statements on any OS.

-Jeff



More information about the Python-list mailing list