IOError when printing in Python service after 2 days

Jason R. Coombs jaraconospam at jaraco.com
Fri Nov 30 23:19:17 EST 2001


I'm getting an exception in my code in a print statement.

I'm running my program as a service using the service classes provided in
ActivePython.

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.
I'm having difficulty identifying this as anything but a bug in Python.  I
suspect it has to do with redirection of standard output in the service
handling.

It's possible that in writing services, I'm supposed to do something with
the output, but I'm not.

Does anyone have a suggestion on this?

Thanks,
Jason





More information about the Python-list mailing list