Skip to content
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

Compatibility with Python 3.12 - RuntimeError: There is no current event loop in thread 'MainThread'. #154

Open
hrnciar opened this issue Feb 14, 2023 · 0 comments · May be fixed by #155
Open

Comments

@hrnciar
Copy link

hrnciar commented Feb 14, 2023

Hello,

in Fedora, we are rebuilding all Python packages with the upcoming Python 3.12 (currently 5th alpha). I am getting this error:

RuntimeError: There is no current event loop in thread 'MainThread'.

The get_event_loop() method of the default event loop policy now emits a DeprecationWarning if there is no current event loop set and it decides to create one. (Contributed by Serhiy Storchaka and Guido van Rossum in python/cpython#100160.)

======================================================================
ERROR: test_before_after (tests.test.CoroutineTestCase.test_before_after)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/decorator-5.1.1/src/tests/test.py", line 42, in test_before_after
    out = get_event_loop().run_until_complete(coro('x'))
          ^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.12/asyncio/events.py", line 676, in get_event_loop
    raise RuntimeError('There is no current event loop in thread %r.'
RuntimeError: There is no current event loop in thread 'MainThread'.

======================================================================
ERROR: test_coro_to_func (tests.test.CoroutineTestCase.test_coro_to_func)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/decorator-5.1.1/src/tests/test.py", line 50, in test_coro_to_func
    self.assertEqual(coro('x'), 'x')
                     ^^^^^^^^^
  File "/builddir/build/BUILD/decorator-5.1.1/src/decorator.py", line 232, in fun
    return caller(func, *(extras + args), **kw)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/builddir/build/BUILD/decorator-5.1.1/src/tests/test.py", line 33, in coro_to_func
    return get_event_loop().run_until_complete(coro(*args, **kw))
           ^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.12/asyncio/events.py", line 676, in get_event_loop
    raise RuntimeError('There is no current event loop in thread %r.'
RuntimeError: There is no current event loop in thread 'MainThread'.

----------------------------------------------------------------------
Ran 24 tests in 5.829s

FAILED (errors=2)
hrnciar added a commit to hrnciar/decorator that referenced this issue Feb 22, 2023
@hrnciar hrnciar linked a pull request Feb 22, 2023 that will close this issue
hrnciar added a commit to hrnciar/decorator that referenced this issue Feb 27, 2023
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 a pull request may close this issue.

1 participant