Re: How to perform a nonblocking read from a process

2008-06-04 Thread Nick Craig-Wood
[EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Hi, > I'm trying to perform following operation from inside the python > script > 1. Open a shell ( start a process ) > 2. Send command1 to the process > 3. Get output from the process > 4. Send command2 to the process > 5. Get output from the

Re: How to perform a nonblocking read from a process

2008-06-04 Thread sturlamolden
On Jun 4, 8:45 am, [EMAIL PROTECTED] wrote: > I've to admit I'm a newbie to this kind of programming... > what if I have to run thousands of these commands...it doesn't make > sense to create > thousands of threads.. > Is there a way that above mentioned piece of code be made to worked... Are yo

Re: How to perform a nonblocking read from a process

2008-06-03 Thread rdabane
On Jun 3, 7:53 pm, sturlamolden <[EMAIL PROTECTED]> wrote: > On Jun 4, 3:20 am, [EMAIL PROTECTED] wrote: > > > It seems that stdout.readline() is a blocking read and it just gets > > stuck their.. > > How to fix this .. > > Threads are the simplest remedy for blocking i/o. > Threads are the simp

Re: How to perform a nonblocking read from a process

2008-06-03 Thread sturlamolden
On Jun 4, 3:20 am, [EMAIL PROTECTED] wrote: > It seems that stdout.readline() is a blocking read and it just gets > stuck their.. > How to fix this .. Threads are the simplest remedy for blocking i/o. -- http://mail.python.org/mailman/listinfo/python-list

How to perform a nonblocking read from a process

2008-06-03 Thread rdabane
Hi, I'm trying to perform following operation from inside the python script 1. Open a shell ( start a process ) 2. Send command1 to the process 3. Get output from the process 4. Send command2 to the process 5. Get output from the process .. Following is sample code : from subprocess import *