How to respond to a confirmation prompt automatically
rw at smsnet.pl
Fri Jan 12 23:35:03 CET 2007
"Coby" <firefoxxer at gmail.com> writes:
> Just to give you some background about my problem:
> I execute os.system(command), where command is a string.
> On the command line in windows, I get:
> "Continue, and unload these objects? [no]"
> I need to respond 'y' to continue, but I am uncertain on how to output
> the 'y' automatically.
You need to use pipe.
p = os.popen(command, "w")
from subprocess import Popen, PIPE
p = Popen(command, shell=True, stdin=PIPE)
More information about the Python-list