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 the problem. I've used a similar command structure (echo foo | sudo -S command) to invoke sudo from a program. Here's the code I used to get this running successfully: --- import os file = os.popen('echo foo| sudo -S /usr/sbin/tcpdump -v -i en1', 'r') for line in file: print line --- I left out the "r" flag. D'oh. I've gotten a bit lost among the various ways of invoking external commands in Python (spawn, popen, system, subprocess). I'm glad os.popen still works. -- Kevin Walzer Poetic Code http://www.kevin-walzer.com -- http://mail.python.org/mailman/listinfo/python-list