dacha...@gmail.com writes: > On Monday, 26 November 2012 16:32:22 UTC+5:30, Kushal Kumaran wrote: >> dacha...@gmail.com writes: >> >> >> >> > 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. >> >> >> >> >> >> You could pass in a stdin argument to subprocess.check_output with a >> >> value of 't\n'. >> >> >> >> However, you might want to use something like http://pysvn.tigris.org/, >> >> which is a python library for accessing subversion repositories. >> >> >> > > Hi Kushal, > > I tried passing the value 't\n' to check_output. But I think we cannot pass a > string to stdin. > > When I tried the below command, > subprocess.check_output([svn, "list", repos_Url], stdin='t\n', > stderr=subprocess.STDOUT) > > I got the below error message, > File "C:\Python27\lib\subprocess.py", line 786, in _get_handles > p2cread = msvcrt.get_osfhandle(stdin.fileno()) > AttributeError: 'str' object has no attribute 'fileno' > > could you tell me how to pass the value to stdin..
Follow Chris Rebert's suggestion to use subprocess.Popen and the communicate method of the Popen object. Have you taken a look at pysvn? -- regards, kushal -- http://mail.python.org/mailman/listinfo/python-list