Re: Question about pipes/os.popen

2006-09-15 Thread Donn Cave
In article <[EMAIL PROTECTED]>, Steve Holden <[EMAIL PROTECTED]> wrote: [ someone's command that fails, run in popen ] > > cmd.read() > > > > This returns output of "". ... > > I'm not sure what I'm doing wrong here. > > > Probably expecting sudo to read the standard input for its password. Al

Re: Question about pipes/os.popen

2006-09-15 Thread Kevin Walzer
Steve Holden wrote: >> > Probably expecting sudo to read the standard input for its password. > > First of all, sudo doesn't always ask for your password. Secondly, when > it does I'm pretty sure it will take care to try and do it on the > controlling tty, not by reading stdin. > sudo wasn't th

Re: Question about pipes/os.popen

2006-09-15 Thread Steve Holden
Kevin Walzer wrote: > I'm trying to structure a Python script that streams output over a pipe. > > Here is my code: > > import os > > cmd = os.popen('echo foo | sudo -S /usr/sbin/tcpdump -en1') > cmd.read() > > This returns output of "". I'm expecting the standard output of "tcpdump > -en1". Ho

Question about pipes/os.popen

2006-09-15 Thread Kevin Walzer
I'm trying to structure a Python script that streams output over a pipe. Here is my code: import os cmd = os.popen('echo foo | sudo -S /usr/sbin/tcpdump -en1') cmd.read() This returns output of "". I'm expecting the standard output of "tcpdump -en1". How does one read unbuffered output over a p