IOError when printing in Python service after 2 days

Fredrik Lundh fredrik at pythonware.com
Sat Dec 1 08:51:34 EST 2001


Jason R. Coombs wrote:
> The program doesn't crash in debug mode.  In run mode, it runs fine for a
> couple of days, then I get this exception in one of my threads:
>
> Exception at Thu Nov 29 04:04:20 2001
> Traceback (most recent call last):
>   File "C:\bin\FileChangeNotifier.py", line 87, in run
>     self.Handle( filepath )
>   File "C:\bin\watch.py", line 41, in SetLastChange
>     print time.asctime(), 'Change detected in', filename
> IOError: [Errno 9] Bad file descriptor
>
> So, something strange appears to be happening to the stdout file
> descriptor.

how much data do you print?  approximately how much data
have you printed after a couple of days?

it could be that you're slowly filling up the output buffer, and
you get the error when stdio flushes the buffer.

try running the program with the -u option, and see if you get
the error sooner.

> I'm having difficulty identifying this as anything but a bug in Python.

well, unlike most C or C++ code, Python actually checks the
error status after each stdio call...

</F>

<!-- (the eff-bot guide to) the python standard library:
http://www.pythonware.com/people/fredrik/librarybook.htm
-->





More information about the Python-list mailing list