filedescriptor out of range in select()

Erik Max Francis max at alcyone.com
Thu Jun 26 05:26:54 EDT 2003


Andrew Bennetts wrote:

> I'm not very familiar with BSD, asyncore or spambayes, but I think
> "filedescriptor out of range in select()" usually means that the
> process is
> trying to handle too many connections at once -- maybe the sockets
> aren't
> getting closed, or something.

I strongly suspect it means that the file descriptor (or the result of
calling the .fileno method of a socket-like object) passed in one of the
objects is way out of range for being a valid file descriptor number. 
If it were simply bad (i.e., not corresponding to any valid file within
that process but a legal value), the error would be "Bad file
descriptor":

max at oxygen:~% python
Python 2.2.3 (#1, May 31 2003, 21:31:33) 
[GCC egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import select
>>> select.select([4], [], [], 0)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
select.error: (9, 'Bad file descriptor')
>>> select.select([10000000], [], [], 0)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
ValueError: filedescriptor out of range in select()

-- 
   Erik Max Francis && max at alcyone.com && http://www.alcyone.com/max/
 __ San Jose, CA, USA && 37 20 N 121 53 W && &tSftDotIotE
/  \ Only the ephemeral is of lasting value.
\__/  Ionesco




More information about the Python-list mailing list