[python-win32] Welcome to the "python-win32" mailing list
Tim Roberts
timr at probo.com
Mon Dec 29 19:47:15 CET 2008
Tim Roberts wrote:
> Well, "select" is not just a drop-in replacement for "poll", although it
> can serve the same function. Without looking at the rest of the source,
> you probably want something like this:
>
> def Run( self ):
> self._fdmap = {}
> self._PrepareSockets()
> while 1:
> fdi = select.select( self._fdmap, [], [] )[0]
>
I just realized this is not correct. _fdmap is a dictionary, and it
needs to be a list of FDs. _fdmap probably contains the list of read
FDs, write FDs, and other FDs -- exactly the way select.select wants
them -- but you'll have to look inside _PrepareSockets to know how to
pull out the three individual lists.
OK, after looking at the source, I think the list of fds is actually the
keys of the dictionary, so we need two small changes:
def Run( self ):
self._fdmap = {}
self._PrepareSockets()
while 1:
fdi = select.select( self._fdmap.keys(), [], [] )[0]
if fdi:
self._ProcessInput( self._fdmap[fdi[0]] )
else:
logger.error( "select returned empty." )
--
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.
More information about the python-win32
mailing list