Asyncore select statement problem

JamesHoward James.w.Howard at gmail.com
Wed Jan 17 18:05:20 EST 2007


I have a problem with python's asyncore module throwing a bad file
descriptor error.  The code might be difficult to copy here, but the
problem is essentially:

The server wants to sever the connection of an open Asyncore socket.
Calling the socket.close() nor the socket.shutdown(2) calls seem to
work.  The only way I can close the connection without creating the
error below is to have the client close the connection.

I have the asyncore.loop() as the last line of a thread that is spawned
within the applications "mainframe.py" or gui thread.  It doesn't seem
to me like this would make a difference, but I am unfamiliar with the
specifics of how the asyncore module works.

Any thoughts people have would be greatly appreciated.  If needed I may
be able to create a small version of the problem to post for people to
see.

Thanks,
Jim Howard


Exception in thread Thread-1:
Traceback (most recent call last):
  File
"/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/threading.py",
line 460, in __bootstrap
    self.run()
  File
"/Users/jwhoward2/Documents/Projects/LJServer/LJDeviceServer/DeviceServer.py",
line 23, in run
    asyncore.loop()
  File
"/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/asyncore.py",
line 191, in loop
    poll_fun(timeout, map)
  File
"/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/asyncore.py",
line 121, in poll
    r, w, e = select.select(r, w, e, timeout)
error: (9, 'Bad file descriptor')




More information about the Python-list mailing list