Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
DavidCEllis opened this issue May 12, 2025 · 2 comments · May be fixed by #5799
Open

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

DavidCEllis opened this issue May 12, 2025 · 2 comments · May be fixed by #5799

Comments

@DavidCEllis
Copy link

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

Copy link

Thank you for your issue. Give us a little time to review it.

PS. You might want to check the FAQ if you haven't done so already.

This is an automated reply, generated by FAQtory

@graingert
Copy link

Dup of #5788

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants