473,326 Members | 2,023 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,326 software developers and data experts.

Non-blocking subprocess call

I'm currently using os.popen in an application of mine, which calls for
non-blocking data, in this fashion:

self.file = os.popen('echo %s | sudo -S /sw/bin/fink -y install %s' %
(self.passtext, self.packagename), 'r', os.O_NONBLOCK)

What is the equivalent/comparable call in the new subprocess module? I
can't find any reference in the Python docs to non-blocking streams.

--
Kevin Walzer
Code by Kevin
http://www.codebykevin.com
Jun 2 '07 #1
3 2383
Kevin Walzer wrote:
I'm currently using os.popen in an application of mine, which calls for
non-blocking data, in this fashion:

self.file = os.popen('echo %s | sudo -S /sw/bin/fink -y install %s' %
(self.passtext, self.packagename), 'r', os.O_NONBLOCK)

What is the equivalent/comparable call in the new subprocess module? I
can't find any reference in the Python docs to non-blocking streams.
If you are talking about non-blocking reading and writing from the
subprocess, there isn't natively. But there is a cookbook entry:
http://aspn.activestate.com/ASPN/Coo.../Recipe/440554

- Josiah
Jun 2 '07 #2
Josiah Carlson wrote:
>
If you are talking about non-blocking reading and writing from the
subprocess, there isn't natively. But there is a cookbook entry:
http://aspn.activestate.com/ASPN/Coo.../Recipe/440554

- Josiah
Any idea why this feature was removed from the language? It seems pretty
essential to me.

--
Kevin Walzer
Code by Kevin
http://www.codebykevin.com
Jun 2 '07 #3
Kevin Walzer <kw@codebykevin.comwrote:
I'm currently using os.popen in an application of mine, which calls for
non-blocking data, in this fashion:

self.file = os.popen('echo %s | sudo -S /sw/bin/fink -y install %s' %
(self.passtext, self.packagename), 'r', os.O_NONBLOCK)

What is the equivalent/comparable call in the new subprocess module? I
can't find any reference in the Python docs to non-blocking
streams.
You'll probably be better off with the pexpect module for this

http://pexpect.sourceforge.net/

Doesn't work on windows. Looks like you are doing OS X though so
should work fine there

--
Nick Craig-Wood <ni**@craig-wood.com-- http://www.craig-wood.com/nick
Jun 4 '07 #4

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

Similar topics

12
by: lothar | last post by:
re: 4.2.1 Regular Expression Syntax http://docs.python.org/lib/re-syntax.html *?, +?, ?? Adding "?" after the qualifier makes it perform the match in non-greedy or minimal fashion; as few...
5
by: klaus triendl | last post by:
hi, recently i discovered a memory leak in our code; after some investigation i could reduce it to the following problem: return objects of functions are handled as temporary objects, hence...
1
by: Markus Ernst | last post by:
Hi I wrote a function that "normalizes" strings for use in URLs in a UTF-8 encoded content administration application. After having removed the accents from latin characters I try to remove all...
4
by: bwmiller16 | last post by:
Guys - I'm doing a database consistency check for a client and I find that they're building unique indexes for performance/query reasons where they could be using non-unique indexes. Note...
32
by: Adrian Herscu | last post by:
Hi all, In which circumstances it is appropriate to declare methods as non-virtual? Thanx, Adrian.
14
by: Patrick Kowalzick | last post by:
Dear all, I have an existing piece of code with a struct with some PODs. struct A { int x; int y; };
2
by: Ian825 | last post by:
I need help writing a function for a program that is based upon the various operations of a matrix and I keep getting a "non-aggregate type" error. My guess is that I need to dereference my...
0
by: amitvps | last post by:
Secure Socket Layer is very important and useful for any web application but it brings some problems too with itself. Handling navigation between secure and non-secure pages is one of the cumbersome...
399
by: =?UTF-8?B?Ik1hcnRpbiB2LiBMw7Z3aXMi?= | last post by:
PEP 1 specifies that PEP authors need to collect feedback from the community. As the author of PEP 3131, I'd like to encourage comments to the PEP included below, either here (comp.lang.python), or...
13
by: asm23 | last post by:
Hi,I need some help to clarify the warning "initial value of reference to non-const must be an lvalue". I'm searching in this groups to find someone has the same situation like me. I found in...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.