이 조각을 계속합니다.서브 프로세스의 코드
스크립트의 각 루프에 대해 outputText를 실행하고 하위 프로세스가 완료되지 않은 경우 변경할 수있는 항목은 무엇입니까? 나는 결국 .wait()를 시도했지만 "int"객체로 오류가 발생했습니다. '통신'이라는 속성이 없습니다.
감사합니다. Chris.
편집 :
Ignoring profile '\\MachineName\C$\Users\UserName1' (reason: directory inclusion)
Ignoring profile '\\MachineName\C$\Users\UserName2' (reason: directory inclusion)
The following user profiles match the deletion criteria:
\\MachineName\C$\Users\UserName3
가있을 수 많은 선이 출력에 포함 :이 명령의 출력 중 하나 반복의 예입니다. 이것은에서 outputText
에 서브 프로세스에서 하나를 stdout
의 각 행을 삽입합니다
reply = subprocess.Popen(Command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
for line in reply.stdout:
outputText.insert("end", line +"\n")
:
당신은'reply = subprocess.Popen (...). wait()'을 시도하셨습니까? 대신,'reply = subprocess.Popen (...)'을 그대로 사용하고,'reply.wait()'를 자신의 줄에 넣으십시오. ('wait '도이 상황에서 유용할지 모르겠지만 적어도 속성 오류를 고쳐야한다.) – Kevin
Thanks @Kevin. 그것은 오류를 없애 버렸지 만, 당신 말이 맞습니다. 전혀 도움이되지 않았습니다. 롤. – user3514446
그래서'Command'가 각 명령 행을 출력하기를 원합니다.'Command'가 끝난 후에 출력하는 것이 아니라 아직도 실행 중입니까? – dano