By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,235 Members | 1,022 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,235 IT Pros & Developers. It's quick & easy.

Non-blocking subprocess call

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.