ahk
ahk copied to clipboard
How to avoid extra console output of async application
describe your issue
When running the demo code
from ahk import AsyncAHK
import asyncio
ahk = AsyncAHK()
async def main():
await ahk.mouse_move(100, 100)
x, y = await ahk.get_mouse_position()
print(x, y)
asyncio.run(main())
I get
..\..\App\WinPython\python-3.12.4.amd64\python.exe C:\python_env\workspace\automation\auto_hotkey\demo.py
100 100
Exception ignored in: <function BaseSubprocessTransport.__del__ at 0x000001DAE0B754E0>
Traceback (most recent call last):
File "C:\python_env\App\WinPython\python-3.12.4.amd64\Lib\asyncio\base_subprocess.py", line 126, in __del__
File "C:\python_env\App\WinPython\python-3.12.4.amd64\Lib\asyncio\base_subprocess.py", line 104, in close
File "C:\python_env\App\WinPython\python-3.12.4.amd64\Lib\asyncio\proactor_events.py", line 109, in close
File "C:\python_env\App\WinPython\python-3.12.4.amd64\Lib\asyncio\base_events.py", line 795, in call_soon
File "C:\python_env\App\WinPython\python-3.12.4.amd64\Lib\asyncio\base_events.py", line 541, in _check_closed
RuntimeError: Event loop is closed
Process finished with exit code 0
=> How to avoid the output about ignored exception?
ahk.version
No response
AutoHotkey version
No response
Code to reproduce the issue
Traceback/Error message
No response
Great question. I'm not sure!
A few possible suggestions in this thread, but I'm not sure if there's anything sane I can change in the library implementation to deal with this.
https://stackoverflow.com/questions/63860576/asyncio-event-loop-is-closed-when-using-asyncio-run