Skip to content

How to avoid extra console output of async application #383

@fhgisi

Description

@fhgisi

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

Image

..\..\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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions