472,992 Members | 3,294 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,992 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 2371
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: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
3
SueHopson
by: SueHopson | last post by:
Hi All, I'm trying to create a single code (run off a button that calls the Private Sub) for our parts list report that will allow the user to filter by either/both PartVendor and PartType. On...

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.