質問

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.

役に立ちましたか?

解決

Try without shell=True:

log = subprocess.Popen(mycmd, 
                       stdin = subprocess.PIPE, stdout = subprocess.PIPE,
                       stderr = subprocess.PIPE)
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top