473,405 Members | 2,310 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Non blocking read from stdin on windows.

Hi
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.

Barr

Jul 18 '05 #1
1 6469
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,
Noam
Jul 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Arnau Sánchez | last post by:
Hello, I have a problem when reading from stdin (using it as pipe) in a Python program (the sender is written in C): C (sender) write(1, buffer, 4) Python (recv.py) sys.stdin.read(256) ...
5
by: Jeff Learman | last post by:
I want to do a very simple thing in Windows. (Using Python Shell.) I want to write a prompt to sys.stdout and read the user input. (Ideally, without waiting for a newline.) Here are the...
3
by: Uwe Mayer | last post by:
Hi, I want two python programs to communicate over stdIO channels. The one executes the other via the popen3 function: amc = Popen3("./amc/amc.py", True, 0) line = stdin.readline()...
1
by: Uwe Mayer | last post by:
Hi, I use select() to wait for a file object (stdin) to become readable. In that situation I wanted to read everything available from stdin and return to the select statement to wait for more. ...
4
by: Jonathan Fine | last post by:
Hello I have written a program that interacts with a command line program. Roughly speaking, it mimics human interaction. (With more speed and accuracy, less intelligence.) It works fine...
1
by: Jakob Bieling | last post by:
Hi, whenever I try to read input from stdin, the called function (ie. std::cin.read ()) blocks until my buffer is full. But I want to function to return immediately, regardless of having read...
7
by: hg | last post by:
Hi, Is there a way ? ... select ? hg
12
by: puzzlecracker | last post by:
is it even possible or/and there is a better alternative to accept input in a nonblocking manner?
0
by: James Mills | last post by:
On Fri, Nov 7, 2008 at 8:54 AM, Thomas Christensen <thomasc@thomaschristensen.orgwrote: Check out circuits . It has a Component called Stdin which allows you to have non-blocking Standard...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.