Re: Direct interaction with subprocess - the curse of blocking I/O

2009-07-03 Thread yam850
On 1 Jul., 21:30, spillz damienlmo...@gmail.com wrote: On Jun 29, 3:15 pm, Pascal Chambon chambon.pas...@gmail.com wrote: I've had real issues with subprocesses recently : from a python script, on windows, I wanted to give control to a command line utility, i.e forward user in put to it and

Re: Direct interaction with subprocess - the curse of blocking I/O

2009-07-03 Thread Scott David Daniels
yam850 wrote: I made a python method/function for non blocking read from a file object I am happy to see comments. OK, here's a fairly careful set of comments with a few caveats: Does this work on windows? The top comment should say where you know it works. Does this code correctly

Re: Direct interaction with subprocess - the curse of blocking I/O

2009-07-03 Thread yam850
On 3 Jul., 17:43, Scott David Daniels scott.dani...@acm.org wrote: yam850 wrote: I made a python method/function for nonblockingread from a file object I am happy to see comments. OK, here's a fairly careful set of comments with a few caveats: [snip] valuable comments --Scott David

Re: Direct interaction with subprocess - the curse of blocking I/O

2009-07-02 Thread Pascal Chambon
Thank you all for the comments you might want something like Expect. Yes Expect deals with such things, unfortunately it's posix only (due to the PTY module requirement...); whereas I'd like to find generic ways (i.e at least windows/linux/mac recipes) The latter is inherently tricky

Re: Direct interaction with subprocess - the curse of blocking I/O

2009-07-01 Thread Lawrence D'Oliveiro
In message b1d86eff- c1a6-45b7-9784-9137f5e1c...@f33g2000vbm.googlegroups.com, ryles wrote: On Jun 29, 5:43 pm, Scott David Daniels scott.dani...@acm.org wrote: and I personally wouldn't have it any other way. Simulating a shell with hooks on its I/O should be so complicated that a script

Re: Direct interaction with subprocess - the curse of blocking I/O

2009-07-01 Thread spillz
On Jun 29, 3:15 pm, Pascal Chambon chambon.pas...@gmail.com wrote: Hello everyone I've had real issues with subprocesses recently : from a python script, on windows, I wanted to give control to a command line utility, i.e forward user in put to it and display its output on console. It seems

Re: Direct interaction with subprocess - the curse of blocking I/O

2009-07-01 Thread ryles
On Jun 29, 5:43 pm, Scott David Daniels scott.dani...@acm.org wrote:  and I personally wouldn't have it any other way. Simulating a shell with hooks on its I/O should be so complicated that a script kiddie has trouble writing a Trojan. +1 QOTW --

Re: Direct interaction with subprocess - the curse of blocking I/O

2009-06-30 Thread cgoldberg
So well, I'd like to know, do you people know any solution to this simple problem - making a user interact directly with a subprocess? you might want something like Expect. check out the pexpect module: http://pexpect.sourceforge.net/pexpect.html -Corey --

Direct interaction with subprocess - the curse of blocking I/O

2009-06-29 Thread Pascal Chambon
Hello everyone I've had real issues with subprocesses recently : from a python script, on windows, I wanted to give control to a command line utility, i.e forward user in put to it and display its output on console. It seems simple, but I ran into walls : - subprocess.communicate() only deals

Re: Direct interaction with subprocess - the curse of blocking I/O

2009-06-29 Thread Nobody
On Mon, 29 Jun 2009 21:15:52 +0200, Pascal Chambon wrote: I've had real issues with subprocesses recently : from a python script, on windows, I wanted to give control to a command line utility, i.e forward user in put to it and display its output on console. Are you talking about a

Re: Direct interaction with subprocess - the curse of blocking I/O

2009-06-29 Thread Scott David Daniels
Pascal Chambon wrote: I've had real issues with subprocesses recently : from a python script, on windows, I wanted to give control to a command line utility, i.e forward user in put to it and display its output on console Browsing the web, I found some hints : - use the advanced win32 api

Re: Direct interaction with subprocess - the curse of blocking I/O

2009-06-29 Thread Lawrence D'Oliveiro
In message mailman.2320.1246302955.8015.python-l...@python.org, Pascal Chambon wrote: I met the issue : select() works only on windows ... No it doesn't. It works only on sockets on Windows, on Unix/Linux it works with all file descriptors http://docs.python.org/library/select.html. --