Skip to content

server: Explicitly create asyncio event loop for python 3.14#57

Merged
SmithChart merged 1 commit intopengutronix:masterfrom
jonrebm:py314
Feb 26, 2026
Merged

server: Explicitly create asyncio event loop for python 3.14#57
SmithChart merged 1 commit intopengutronix:masterfrom
jonrebm:py314

Conversation

@jonrebm
Copy link
Copy Markdown
Contributor

@jonrebm jonrebm commented Feb 16, 2026

Starting with python 3.14, asyncio.get_event_loop() "Raises a RuntimeError if there is no current event loop." which we hit when trying to run the server with 3.14.3:

  File "flamingo/test-site/env/bin/flamingo", line 27, in <module>
    runpy.run_path(scripts[args.command])
    ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen runpy>", line 287, in run_path
  File "<frozen runpy>", line 98, in _run_module_code
  File "<frozen runpy>", line 88, in _run_code
  File "flamingo/test-site/env/bin/_flamingo-server", line 63, in <module>
    loop = asyncio.get_event_loop()
  File "/usr/lib/python3.14/asyncio/events.py", line 715, in get_event_loop
    raise RuntimeError('There is no current event loop in thread %r.'
                       % threading.current_thread().name)
RuntimeError: There is no current event loop in thread 'MainThread'.

Create the event loop instead.

Starting with python 3.14, asyncio.get_event_loop() "Raises a
RuntimeError if there is no current event loop." which we hit when
trying to run the server with 3.14.3:

  File "flamingo/test-site/env/bin/flamingo", line 27, in <module>
    runpy.run_path(scripts[args.command])
    ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen runpy>", line 287, in run_path
  File "<frozen runpy>", line 98, in _run_module_code
  File "<frozen runpy>", line 88, in _run_code
  File "flamingo/test-site/env/bin/_flamingo-server", line 63, in <module>
    loop = asyncio.get_event_loop()
  File "/usr/lib/python3.14/asyncio/events.py", line 715, in get_event_loop
    raise RuntimeError('There is no current event loop in thread %r.'
                       % threading.current_thread().name)
RuntimeError: There is no current event loop in thread 'MainThread'.

Create the event loop instead.

Signed-off-by: Jonas Rebmann <jre@pengutronix.de>
@jonrebm
Copy link
Copy Markdown
Contributor Author

jonrebm commented Feb 16, 2026

CI failure seems to not be my fault we have
flamingo/plugins/rst/bootstrap3.py:75:80: E501 line too long (124 > 79 characters)
and
Error: The version '3.7' with architecture 'x64' was not found for Ubuntu 24.04.

@jonrebm jonrebm mentioned this pull request Feb 16, 2026
@SmithChart
Copy link
Copy Markdown
Member

CI failure seems to not be my fault we have flamingo/plugins/rst/bootstrap3.py:75:80: E501 line too long (124 > 79 characters) and Error: The version '3.7' with architecture 'x64' was not found for Ubuntu 24.04.

Yes. Fixing that is part of a larger changeset I am currently preparing. Sorry for that noise!

Copy link
Copy Markdown
Member

@SmithChart SmithChart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix. I've given this a test on Python 3.11 (Debian oldstable) and python 3.13 (Debian stable) and it works there, too.

So: Looks good to me.

@SmithChart SmithChart merged commit 440833d into pengutronix:master Feb 26, 2026
1 of 7 checks passed
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.

2 participants