Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Non blocking read from stdin on windows.

Thread Tools

Non blocking read from stdin on windows.

Posts: n/a
Can any one help.

I am trying to write a python scipt that takes input as args and/or as piped
input ( possibly the output of another program).

I want to read stdin ( the piped in stuuff ) whcih might be empty without
the script blocking if it is empty.

I understand it is possible to do under unix with the select call. Can some
one please explain how to do this in windows.

thanks in advance.


Reply With Quote
Noam Raphael
Posts: n/a
You can always have a thread which continually reads stdin and stores it
in a string, or better, in a cStringIO.StringIO object. Then in the main
thread, you can check whether something new has arrived. This, of course
will work on all platforms.

I hope this helped a bit,
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Non blocking socket keep blocking on read ? Serge Savoie Ruby 4 10-01-2008 03:16 PM
HELP Non-Blocking reads from sys.stdin in Windows. barr Python 3 12-28-2004 08:38 PM
blocking read on stdin on Windows? Jeff Learman Python 5 09-05-2004 02:10 AM
Reading stdin once confuses second stdin read Charlie Zender C Programming 6 06-21-2004 01:39 PM
Blocking and non blocking assignment in VHDL Hendra Gunawan VHDL 1 04-08-2004 06:03 AM