I am unsure about implications to other backends and other platforms, So I am not proposing this through a PR as the following is possibly not a universal fix
import asyncio
......
....
class BaseCommand(object):
...
...
def __call__(self, *args, _anyio_backend=None, _anyio_backend_options={'policy':asyncio.WindowsProactorEventLoopPolicy()},**kwargs):
"""Alias for :meth:`main`."""
main = self.main
if _anyio_backend is None:
import asyncclick
_anyio_backend = asyncclick.anyio_backend
return anyio.run(self._main, main, args, kwargs, backend=_anyio_backend, backend_options=_anyio_backend_options)
(Tools20W39Py376) PS C:\Users\<USER>\SANDBOXplaywright> python .\async_click_playwright.py
Traceback (most recent call last):
File ".\async_click_playwright.py", line 24, in <module>
main(_anyio_backend="asyncio")
File "c:\users\<USER>\axternal\asyncclick\asyncclick\core.py", line 865, in __call__
return anyio.run(self._main, main, args, kwargs, backend=_anyio_backend)
File "C:\Users\<USER>\Anaconda3\envs\Tools20W39Py376\lib\site-packages\anyio\_core\_eventloop.py", line 52, in run
return asynclib.run(func, *args, **backend_options) # type: ignore
File "C:\Users\<USER>\Anaconda3\envs\Tools20W39Py376\lib\site-packages\anyio\_backends\_asyncio.py", line 160, in run
return native_run(wrapper(), debug=debug)
File "C:\Users\<USER>\Anaconda3\envs\Tools20W39Py376\lib\asyncio\runners.py", line 43, in run
return loop.run_until_complete(main)
File "C:\Users\<USER>\Anaconda3\envs\Tools20W39Py376\lib\asyncio\base_events.py", line 583, in run_until_complete
return future.result()
File "C:\Users\<USER>\Anaconda3\envs\Tools20W39Py376\lib\site-packages\anyio\_backends\_asyncio.py", line 155, in wrapper
return await func(*args)
File "c:\users\<USER>\axternal\asyncclick\asyncclick\core.py", line 868, in _main
return await main(*args, **kwargs)
File "c:\users\<USER>\axternal\asyncclick\asyncclick\core.py", line 814, in main
rv = await self.invoke(ctx)
File "c:\users\<USER>\axternal\asyncclick\asyncclick\core.py", line 1105, in invoke
return await ctx.invoke(self.callback, **ctx.params)
File "c:\users\<USER>\axternal\asyncclick\asyncclick\core.py", line 644, in invoke
rv = await rv
File ".\async_click_playwright.py", line 9, in main
playwright = await async_playwright().start()
File "C:\Users\<USER>\Anaconda3\envs\Tools20W39Py376\lib\site-packages\playwright\main.py", line 119, in start
return await self.__aenter__()
File "C:\Users\<USER>\Anaconda3\envs\Tools20W39Py376\lib\site-packages\playwright\main.py", line 110, in __aenter__
self._connection = await run_driver_async()
File "C:\Users\<USER>\Anaconda3\envs\Tools20W39Py376\lib\site-packages\playwright\main.py", line 62, in run_driver_async
limit=32768,
File "C:\Users\<USER>\Anaconda3\envs\Tools20W39Py376\lib\asyncio\subprocess.py", line 217, in create_subprocess_exec
stderr=stderr, **kwds)
File "C:\Users\<USER>\Anaconda3\envs\Tools20W39Py376\lib\asyncio\base_events.py", line 1540, in subprocess_exec
bufsize, **kwargs)
File "C:\Users\<USER>\Anaconda3\envs\Tools20W39Py376\lib\asyncio\base_events.py", line 462, in _make_subprocess_transport
raise NotImplementedError