uriyyo / pycharm-evaluate-async-code

Finally, you can use await in evaluate expression 💪
https://plugins.jetbrains.com/plugin/14476-evaluate-async-code
44 stars 2 forks source link

asyncio.create_subprocess_exec() will throw notImplementedError exception on Windows #46

Closed Unintendedz closed 1 year ago

Unintendedz commented 2 years ago

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())
moomoohk commented 2 years ago

Bug occurs on my setup as well

uriyyo commented 1 year ago

Hi @Unintendedz @moomoohk

New version 1.21 has been released. This issue should be fixed now.

uriyyo commented 1 year ago

Hi @Unintendedz,

I am closing this issue. Please, reopen it if you still can reproduce this issue.