Skip to content

asyncio.get_event_loop adapt for python 3.14 - #123

Open
Unfold1344 wants to merge 1 commit into
miaow2:mainfrom
Unfold1344:patch-1
Open

asyncio.get_event_loop adapt for python 3.14#123
Unfold1344 wants to merge 1 commit into
miaow2:mainfrom
Unfold1344:patch-1

Conversation

@Unfold1344

Copy link
Copy Markdown

After upgrading to the latest netbox-docker, python 3.14 is used, which raises a RuntimeError if there is no current event loop upon asyncio.get_event_loop, see: https://docs.python.org/3/library/asyncio-eventloop.html#asyncio.get_event_loop

problem occured when checking diffs for a switch:

{
    "diffs": [],
    "logs": [
        [
            "2026-08-17 11:21:48",
            "info",
            "Working with switch"
        ],
        [
            "2026-08-17 11:21:48",
            "failure",
            "An exception occurred: `RuntimeError: There is no current event loop in thread 'MainThread'.`\n```\nTraceback (most recent call last):\n  File \"/opt/netbox/venv/lib/python3.14/site-packages/netbox_config_diff/jobs.py\", line 22, in collect_diffs\n    configurator.collect_diffs()\n    ~~~~~~~~~~~~~~~~~~~~~~~~~~^^\n  File \"/opt/netbox/venv/lib/python3.14/site-packages/netbox_config_diff/configurator/base.py\", line 107, in collect_diffs\n    loop = asyncio.get_event_loop()\n  File \"/usr/lib/python3.14/asyncio/events.py\", line 715, in get_event_loop\n    raise RuntimeError('There is no current event loop in thread %r.'\n                       % threading.current_thread().name)\nRuntimeError: There is no current event loop in thread 'MainThread'.\n\n```"
        ]
    ]
}

Python 3.14 raises a runtime error if there is no current event loop. Netbox-docker now uses 3.14, breaking the plugin.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant