0

I am trying to use subprocess module with Popen to fetch log from a specified URL, However, I am not able to fetch the log and the program returns me a blank.

I have been using the below mentioned code:

import subprocess
url = r'C:\project\dummy\pro'
mycmd = ['svn', 'log', url]

log = subprocess.Popen(mycmd, shell=True,
                            stdin = subprocess.PIPE, stdout = subprocess.PIPE,
                            stderr = subprocess.PIPE)

result = log.wait()
out1, err = log.communicate()
print out1

I need the output string to use as next part of the program. Any help would be appreciated.

1 Answers1

0

Try without shell=True:

log = subprocess.Popen(mycmd, 
                       stdin = subprocess.PIPE, stdout = subprocess.PIPE,
                       stderr = subprocess.PIPE)
Mike Müller
  • 82,630
  • 20
  • 166
  • 161
  • It worked the way i wanted, except, a blank screen for \bin\svn.exe pops up and doesn;t close by itslef and once i close it, rest of the program runs fine. – user2436752 May 30 '13 at 15:54