"Coby" <[EMAIL PROTECTED]> 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.

1.

p = os.popen(command, "w")
p.write("y\n")

http://docs.python.org/lib/os-newstreams.html#os-newstreams

2.

from subprocess import Popen, PIPE
p = Popen(command, shell=True, stdin=PIPE)
p.stdin.write("y\n")

http://docs.python.org/lib/module-subprocess.html

-- 
HTH,
Rob
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to