Re: check if there is data in stdin without blocking
hg wrote:
Hi,
>
Is there a way ? ... select ?
>
>
>
hg
PS:
import sys
import select
l_r = select.select([sys.stdin],[],[],0)
gives me:
File "select.py" , line 2, in ?
import select
File "/home/philippe/Desktop/select.py", line 4, in ?
l_r = select.select([sys.stdin],[],[],0)
TypeError: 'module' object is not callable
Re: check if there is data in stdin without blocking
hg a écrit :
hg wrote:
>
>Hi,
>>
>Is there a way ? ... select ?
>>
>>
>>
>hg
PS:
>
import sys
import select
>
l_r = select.select([sys.stdin],[],[],0)
>
gives me:
File "select.py" , line 2, in ?
import select
File "/home/philippe/Desktop/select.py", line 4, in ?
l_r = select.select([sys.stdin],[],[],0)
TypeError: 'module' object is not callable
>
>
Wont work under Windows:
>>help(select.s elect)
....<zip>...
*** IMPORTANT NOTICE ***
On Windows, only sockets are supported; on Unix, all file descriptors.
If under Unix, maybe sys.stdin.filen o() is a valid descriptor for
select. Just test it.
And if under Windows, you may take a look at
22.1 msvcrt - Useful routines from the MS VC++ runtime
22.1.2 Console I/O
kbhit( ) - Return true if a keypress is waiting to be read.
Re: check if there is data in stdin without blocking
Laurent Pointal wrote:
hg a écrit :
>hg wrote:
>>
>>Hi,
>>>
>>Is there a way ? ... select ?
>>>
>>>
>>>
>>hg
>PS:
>>
>import sys
>import select
>>
>l_r = select.select([sys.stdin],[],[],0)
>>
>gives me:
> File "select.py" , line 2, in ?
> import select
> File "/home/philippe/Desktop/select.py", line 4, in ?
> l_r = select.select([sys.stdin],[],[],0)
>TypeError: 'module' object is not callable
>>
>>
>
Wont work under Windows:
>>>help(select. select)
...<zip>...
*** IMPORTANT NOTICE ***
On Windows, only sockets are supported; on Unix, all file descriptors.
>
>
>
If under Unix, maybe sys.stdin.filen o() is a valid descriptor for
select. Just test it.
>
And if under Windows, you may take a look at
22.1 msvcrt - Useful routines from the MS VC++ runtime
22.1.2 Console I/O
kbhit( ) - Return true if a keypress is waiting to be read.
Well I'm testing under Linux but need support under Windows ... is there any
way to poll stdin somehow under both plateform ?
Re: check if there is data in stdin without blocking
At Monday 15/1/2007 05:55, hg wrote:
>Well I'm testing under Linux but need support under Windows ... is there any
>way to poll stdin somehow under both plateform ?
I think you may want this portable getch function:
<http://aspn.activestat e.com/ASPN/Cookbook/Python/Recipe/134892>
--
Gabriel Genellina
Softlab SRL
_______________ _______________ _______________ _____
Preguntá. Respondé. Descubrí.
Todo lo que querías saber, y lo que ni imaginabas,
está en Yahoo! Respuestas (Beta).
¡Probalo ya!
Re: check if there is data in stdin without blocking
Gabriel Genellina wrote:
At Monday 15/1/2007 05:55, hg wrote:
>
>>Well I'm testing under Linux but need support under Windows ... is there
>>any way to poll stdin somehow under both plateform ?
>
I think you may want this portable getch function:
<http://aspn.activestat e.com/ASPN/Cookbook/Python/Recipe/134892>
>
>
--
Gabriel Genellina
Softlab SRL
>
>
>
>
>
>
_______________ _______________ _______________ _____
Preguntá. Respondé. Descubrí.
Todo lo que querías saber, y lo que ni imaginabas,
está en Yahoo! Respuestas (Beta).
¡Probalo ya! http://www.yahoo.com.ar/respuestas
Comment