pycharm-evaluate-async-code
pycharm-evaluate-async-code copied to clipboard
asyncio.create_subprocess_exec() will throw notImplementedError exception on Windows
Thanks for the excellent plugin
here is my code for the test
import asyncio
async def main():
await asyncio.create_subprocess_exec('C:/Windows/System32/cmd.exe')
if __name__ == '__main__':
asyncio.run(main())
traceback :
C:\Users\X\scoop\shims\python.exe C:\Users\X\AppData\Roaming\JetBrains\PyCharm2021.3\plugins\evaluate-async-code\_pydevd_async_debug.py "C:\Program Files\JetBrains\PyCharm 2021.3\plugins\python\helpers\pydev\pydevd.py" --multiproc --qt-support=auto --client 127.0.0.1 --port 52157 --file F:/projects/nftest/b.py
Connected to pydev debugger (build 213.6777.50)
Traceback (most recent call last):
File "C:\Users\X\AppData\Roaming\JetBrains\PyCharm2021.3\plugins\evaluate-async-code\_pydevd_async_debug.py", line 38, in run
return loop.run_until_complete(task)
File "C:\Users\X\AppData\Roaming\JetBrains\PyCharm2021.3\plugins\evaluate-async-code\_pydevd_async_debug.py", line 81, in run_until_complete
return f.result()
File "C:\Users\X\scoop\apps\python39\current\lib\asyncio\futures.py", line 201, in result
raise self._exception
File "C:\Users\X\scoop\apps\python39\current\lib\asyncio\tasks.py", line 256, in __step
result = coro.send(None)
File "F:/projects/nftest/b.py", line 5, in main
await asyncio.create_subprocess_exec('C:/Windows/System32/cmd.exe')
File "C:\Users\X\scoop\apps\python39\current\lib\asyncio\subprocess.py", line 236, in create_subprocess_exec
transport, protocol = await loop.subprocess_exec(
File "C:\Users\X\scoop\apps\python39\current\lib\asyncio\base_events.py", line 1661, in subprocess_exec
transport = await self._make_subprocess_transport(
File "C:\Users\X\scoop\apps\python39\current\lib\asyncio\base_events.py", line 493, in _make_subprocess_transport
raise NotImplementedError
NotImplementedError
Process finished with exit code 1
workaround:
import asyncio
async def main():
await asyncio.create_subprocess_exec('C:/Windows/System32/cmd.exe')
if __name__ == '__main__':
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
asyncio.run(main())