Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'python.': 0.02; 'argument': 0.04; 'output': 0.04; 'attribute': 0.05; 'svn': 0.05; 'python': 0.09; 'exception,': 0.09; 'p2cread': 0.09; 'res': 0.09; 'subject:method': 0.09; 'throws': 0.09; 'cc:addr:python-list': 0.10; 'library': 0.15; 'passing': 0.15; '"echo': 0.16; 'command,': 0.16; 'stdin': 0.16; 'subject:pass': 0.16; 'url:svn': 0.16; 'string': 0.17; 'wrote:': 0.17; 'input': 0.18; 'sender:addr:gmail.com': 0.18; 'skip:" 30': 0.20; 'all,': 0.21; 'object.': 0.22; 'subversion': 0.22; 'help.': 0.22; 'cc:2**0': 0.23; 'monday,': 0.23; 'cc:no real name:2**0': 0.24; 'command': 0.24; 'pass': 0.25; 'tried': 0.25; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'skip:m 30': 0.26; 'this?': 0.28; 'chris': 0.28; 'writes:': 0.29; 'error': 0.30; 'file': 0.32; 'suggestion': 0.32; 'could': 0.32; 'skip:s 30': 0.33; 'received:google.com': 0.34; 'list': 0.35; 'process,': 0.35; 'received:209.85.220': 0.35; 'received:209.85': 0.35; 'something': 0.35; 'there': 0.35; 'but': 0.36; 'url:org': 0.36; 'method': 0.36; 'communicate': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'object': 0.38; 'think': 0.40; 'url:ip addr': 0.62; 'email addr:gmail.com': 0.63; 'dont': 0.64; 'validate': 0.65; 'url:0': 0.67; 'received:117': 0.75; 'prompt': 0.78; 'message-id:@mx.google.com': 0.81; 'subject:skip:s 20': 0.91; 'to:none': 0.93 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:cc:subject:in-reply-to:references:user-agent:date :message-id:mime-version:content-type; bh=SD1Op7EIXD4VD/+6mpcCWymhLxWqwayylAMC+SUiegU=; b=b5ICv026+v4Va90gEJec2LIm5o3t9cmGyMJMP55RFf6iRK+Y29ZF5FU9HG6uQinRxT 2Jx8VK22ptMm4RofRDQVFKzxvtEfAU1WlaMe2aBJaIc/3SV2qSm8kpOB7Uy8/AbOsRCH soDTkCPjba1w2ZxIMAW2cQGFmqxqjj/gCjk3XhjiKV6CRjSQNKcYvVoXjTjlLMyGfeYG IllJRQuiAV4kaIJTpafrhv4tRFFmhoGLFFsIZywi0RNxiOjoWWY0ep9SNZ1x6d0dl99g Bn3X4zSlUkxDaCNgvMw8HyPyvRcT4J3Kf08kUGxKudXm3LjaJtUNxAwxqSktfPewIU+b nvmg== Sender: Kushal Kumaran From: Kushal Kumaran Cc: python-list@python.org Subject: Re: how to pass "echo t | " input to subprocess.check_output() method In-Reply-To: <09f48575-30aa-4d29-8042-2dfcaafe6ca8@googlegroups.com> References: <09f48575-30aa-4d29-8042-2dfcaafe6ca8@googlegroups.com> User-Agent: Notmuch/0.14+83~gae459a3 (http://notmuchmail.org) Emacs/24.1.1 (x86_64-pc-linux-gnu) Date: Mon, 26 Nov 2012 18:45:14 +0530 MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 76 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1353935723 news.xs4all.nl 6881 [2001:888:2000:d::a6]:45365 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:33935 dachakku@gmail.com writes: > On Monday, 26 November 2012 16:32:22 UTC+5:30, Kushal Kumaran wrote: >> dachakku@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