Ich habe den folgenden CodeBeenden eines unendlichen Prozesses in Python subprocess
c = open("text.txt", 'a')
output = subprocess.Popen('ping -t 127.0.0.1', stdout=subprocess.PIPE).communicate()[0]
c.write(str(output))
Aber als der Ping unendlich ist, schließen sich die Code stucks in Zeile zwei bis ich das cmd
wie kann ich schließen die unendliche subprocess
ich benutze python 2
Ich benutze Python 2 –
Ich fand die Lösung dank @Saypy –
Prozess = subprocess.Popen ('ping -t 127.0.0.1', stdout = subprozess.PIPE) time.sleep (10) process.kill() output = process.stdout.read() –