[PythonCE] Re: no select module

Guido Wesdorp mailings at johnnydebris.net
Tue Dec 2 05:27:17 EST 2003


mailing at piwo.ws wrote:

>Hi :)
>
>B>   Will select module from windows i386 python 2.2 work ?
>
>Ups, sorry, i am wrong :) I guess it cannot be done so easy :)
>  
>
Indeed. The select .py(c) file is a (compiled) Python script that 
'wraps' a C module. The C module is what does the actual work (in this 
case talking to the OS, handing over some socket(-like objects) and 
getting them back), the py(c) file only makes the C functionality 
available to Python. Without the C module there's no way you're going to 
make this work. To be honest I don't know *why* the select module isn't 
in the Python 2.3 distribution, this could be for a number of reasons: 
either it was too hard or too much work to port the file from 'plain' 
Windows Python to Pocket PC, or perhaps the person who created the 
distribution just didn't care too much (select isn't too commonly used, 
mostly in high-performance servers which you will most likely not want 
to run on your Pocket PC anyway ;) but it might also be that the Windows 
CE operating system just has no support for the very low-level 'select' 
system call. Perhaps David Kashtan, who packed up the distribution, can 
tell you more?

>I need select module within a script i must run on PPC 2003.
>This module is used in two places:
>
>-----------------
>    rlist, wlist, elist = select.select([request], [], [], 0.1)
>-----------------
>
>and here in sockets:
>
>-----------------
>    soc = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
>    soc.connect((HOSTNAME, PORT))
>    soc.send(data)
>    rlist, wlist, elist = select.select([soc], [], [], 15)
>    if rlist:
>        answer = soc.recv(9999)
>        return answer
>    soc.close()
>-----------------
>
>Does anyone know, how can i get the same efect without using select
>module. Sorry, but i am not python programmer :)
>  
>
Well the last one wouldn't be too hard to rewrite using plain sockets 
instead of select I guess (especially since the plain socket module 
supports timeouts nowadays), but I would really need more information to 
know what the first one does... Select can be (ab)used for a lot of 
interesting stuff ;) (although this seems quite straight-forward). I 
don't know what kind of application you are using, and how it is 
licensed, but perhaps you could send me the full source so I can take a 
look?

Cheers,

Guido




More information about the PythonCE mailing list