Skip to content

Deprecation in Python 3.14 will break python -m textual and App.run() #5797

Open
@DavidCEllis

Description

@DavidCEllis

The bug

Python 3.14 removes the ability to use get_event_loop to implicitly create a loop. You can get the same failure with -Werror on Python 3.13.

This means python -m textual errors in 3.14 and App.run() will fail if not given a loop:

$ python -m textual
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Users\ducks\Source\ducktools-pytui\.venv_textualtest\Lib\site-packages\textual\__main__.py", line 5, in <module>
    app.run()
    ~~~~~~~^^
  File "C:\Users\ducks\Source\ducktools-pytui\.venv_textualtest\Lib\site-packages\textual\app.py", line 2154, in run
    event_loop = asyncio.get_event_loop() if loop is None else loop
                 ~~~~~~~~~~~~~~~~~~~~~~^^
  File "C:\Users\ducks\AppData\Local\Python\pythoncore-3.14-64\Lib\asyncio\events.py", line 718, 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'.

It looks like the logic that defended against this was removed recently: 4e4e2a3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions