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

dachakku at gmail.com dachakku at gmail.com
Mon Nov 26 07:05:37 EST 2012


On Monday, 26 November 2012 16:22:42 UTC+5:30, Duncan Booth  wrote:
> 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

Hi Duncan,

I tried using --non-interactive --trust-server-cert, but the call fails with error message,
svn: E175002: OPTIONS of 'https://127.0.0.1/svn/Repos': Server certificate verification failed: certificate issued for a different hostname, issuer is not trusted (https://127.0.0.1)

that's why I want to pass an input to accept the certificate (t)emporarily or (p)ermanently.



More information about the Python-list mailing list