警告:
WARNING: Executing Task pending name='Task-2673' coro=BaseSubprocessTransport._connect_pipes() running at /sarc/cad/tools/conda/envs/p3_impl7/lib/python3.8/asyncio/base_subprocess.py:168 wait_for=Future pending cb=[TaskWakeupMethWrapper object at 0x2b13f6c66e20()] created at /sarc/cad/tools/conda/envs/p3_impl7/lib/python3.8/asyncio/base_events.py:418 created at /sarc/cad/tools/conda/envs/p3_impl7/lib/python3.8/asyncio/base_subprocess.py:53 took 0.424 seconds
代码:
cmd = " ".join(cmd)
proc = await asyncio.create_subprocess_shell(
cmd, cwd=cwd, env=nenv, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE
)
stdout, stderr = await proc.communicate()
res = stdout.decode()
我不确定这段代码被截断是否导致了此错误,但是有数千个这样的create_subprocess_shell
被调用,每个都来自一个独立的任务。如果上述代码中的slow_callback实际上是错误的,我该如何解决?