import os
import subprocess
def ExecuteCmd(self, strCmd):
print "[ExecuteCmd] %s" % (strCmd)
pipe = subprocess.Popen(strCmd,
shell=True,
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
pipe.stdin.close()
retOutputList = []
while( pipe.poll() is None ):
out = pipe.stdout.readline()
if( out != '' ):
print out
retOutputList.append(out)
retCode = pipe.poll()
return (retCode, retOutputList)
def main():
(retCode, stdout) = ExecuteCmd('svn --version')
print 'retCode : ' + str(retCode)
print stdout
if __name__ == "__main__":
try:
main()
except os.error, err:
print str(err)
[Python] ExecuteCmd 커맨드 명령어 실행하기
Python에서 Command 명령어 실행하는 예제
- 이 글의 트랙백 주소
- 이 글에는 트랙백을 보낼 수 없습니다
add
- 댓글 남기기

















