문제

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