how to pass "echo t | " input to subprocess.check_output() method

Chris Rebert clp2 at rebertia.com
Mon Nov 26 12:12:30 CET 2012


On Nov 26, 2012 3:03 AM, "Kushal Kumaran" <kushal.kumaran+python at gmail.com>
wrote:
> dachakku at gmail.com writes:
> > I want to list the repositories in svn using python. For this i have
used below command,
> > " res = subprocess.check_output(["svn.exe", "list", "
Https://127.0.0.1:443/svn/Repos"], stderr=subprocess.STDOUT) "
> >
> > but it throws an exception, since it requires an user input to validate
certificate,
> > " (R)eject, accept (t)emporarily or accept (p)ermanently? "
> >
> > from Command prompt im able to pass the input while calling the
process, and im able to get the output
> >
> > "echo t | svn list Https://127.0.0.1:443/svn/Repos"
> >
> > But i dont know how to pass the "echo t | " in subprocess.check_output
while calling a process.
>
> You could pass in a stdin argument to subprocess.check_output with a
> value of 't\n'.

Strings aren't acceptable stdin values, so that wouldn't work.

Cheers,
Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20121126/841a5aff/attachment.html>


More information about the Python-list mailing list