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

Duncan Booth duncan.booth at invalid.invalid
Mon Nov 26 11:52:40 CET 2012


dachakku at gmail.com wrote:

> Hi all,
> 
> 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. Is there a way to do this?
> Please help.
> 

Run svn once manually as the same user that is running your script then 
when you get the prompt verify that it is indeed the certificate and 
accept it permanently. That will allow your script to work proviuded the 
certificate doesn't change.

Also, change the command you run to include the --non-interactive 
command line option so that if the certificate ever does change in the 
future the command will fail rather than prompting.

Alternatively use --non-interactive --trust-server-cert to just accept 
any old server regardless what certificate it uses, but be aware that 
this impacts security.

-- 
Duncan Booth http://kupuguy.blogspot.com



More information about the Python-list mailing list