i ein einfaches Python-Programm, das ich verwende mit Subprozesse zu testen asyncio:Python Asyncio subprocess nie beendet
import sys, time
for x in range(100):
print("processing (%s/100) " % x)
sys.stdout.flush()
print("enjoy")
sys.stdout.flush()
des Lauf auf der Kommandozeile die gewünschten Ergebnisse liefert.
Wenn jedoch aus asyncio genannt, es endet nie
process = yield from asyncio.create_subprocess_exec(
*["python", "program.py"],
stdout=async_subprocess.PIPE,
stderr=async_subprocess.STDOUT,
cwd=working_dir
)
# this never finishes
yield from process.communicate()
ps ax
zeigt dieser Prozess <defunct>
ist, nicht sicher, was das bedeutet
Was Sie geschrieben haben, ist kein gültiger Python-Code. – Bakuriu