Re: polling for output from a subprocess module

2008-02-06 Thread Thomas Bellman
Ivo <[EMAIL PROTECTED]> wrote: > Thomas Bellman wrote: >> However, the os.read() function will only read what is currently >> available. Note, though, that os.read() does not do line-based >> I/O, so depending on the timing you can get incomplete lines, or >> multiple lines in one read. >> >>

Re: polling for output from a subprocess module

2008-02-05 Thread Ivo
Thomas Bellman wrote: > [EMAIL PROTECTED] wrote: > >> try: >> test = Popen(test_path, >> stdout=PIPE, >> stderr=PIPE, >> close_fds=True, >> env=

Re: polling for output from a subprocess module

2008-02-05 Thread Thomas Bellman
Christian Heimes <[EMAIL PROTECTED]> writes: > Thomas Bellman wrote: >> The readlines() method will read until it reaches end of file (or >> an error occurs), not just what is available at the moment. You >> can see that for your self by running: > Bad idea ;) Why is it a bad idea to see how th

Re: polling for output from a subprocess module

2008-02-04 Thread jakub . hrozek
On 4 Ún, 11:49, Thomas Bellman <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > try: > > test = Popen(test_path, > > stdout=PIPE, > > stderr=PIPE, > > close_fds=True, > >

Re: polling for output from a subprocess module

2008-02-04 Thread Christian Heimes
Thomas Bellman wrote: > The readlines() method will read until it reaches end of file (or > an error occurs), not just what is available at the moment. You > can see that for your self by running: Bad idea ;) readlines() on a subprocess Popen instance will block when you PIPE more than one strea

Re: polling for output from a subprocess module

2008-02-04 Thread Thomas Bellman
[EMAIL PROTECTED] wrote: > try: > test = Popen(test_path, > stdout=PIPE, > stderr=PIPE, > close_fds=True, > env=test_environ) > whi

polling for output from a subprocess module

2008-02-04 Thread jakub . hrozek
Hello, My program uses the subprocess module to spawn a child and capture its output. What I'd like to achieve is that stdout is parsed after the subprocess finishes, but anything that goes to stderr is printed immediately. The code currently looks like: try: test = Popen(test_pa