Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Set running event loop to fix bug with Python 3.8 #13

Merged
merged 1 commit into from
Feb 28, 2020

Conversation

TheGreatCabbage
Copy link
Contributor

@TheGreatCabbage TheGreatCabbage commented Oct 29, 2019

Resolves #3. Fixes #12.

This pull request adds a new constructor parameter to QEventLoop, set_running_loop=True.

When set_running_loop is True, the running event loop will be set with asyncio.events._set_running_loop(self).

This fixes RuntimeError: no running event loop in Python 3.8.

Fix "RuntimeError: no running event loop" in Python 3.8 by calling "asyncio.events._set_running_loop()" in the constructor.
@TheGreatCabbage TheGreatCabbage changed the title Set running event loop to fix bug with Python3.8 Set running event loop to fix bug with Python 3.8 Oct 29, 2019
@codecov
Copy link

codecov bot commented Oct 29, 2019

Codecov Report

Merging #13 into master will increase coverage by 0.26%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #13      +/-   ##
==========================================
+ Coverage   64.66%   64.92%   +0.26%     
==========================================
  Files           4        4              
  Lines         648      650       +2     
==========================================
+ Hits          419      422       +3     
+ Misses        229      228       -1
Impacted Files Coverage Δ
asyncqt/__init__.py 75.78% <100%> (+0.38%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 66ccce1...5a2f75b. Read the comment docs.

@TheGreatCabbage
Copy link
Contributor Author

@gmarull Are you still maintaining asyncqt? I'm not asking for a quick response to my pull request, but it would be great if you could confirm whether you're still active.

dlparker added a commit to dlparker/asyncqt that referenced this pull request Nov 4, 2019
@TheGreatCabbage
Copy link
Contributor Author

This is now fixed in qasync, my fork of asyncqt which is actively maintained and published on PyPI. It aims to replace asyncqt now that it appears to be unmaintained.

If you'd like to make a pull request in qasync from an asyncqt fork, you can make a request in TheGreatCabbage/asyncqt and I'll push the changes to qasync.

@gmarull gmarull merged commit 67b59c5 into gmarull:master Feb 28, 2020
JensGutermuth added a commit to JensGutermuth/pyrpl that referenced this pull request Dec 6, 2020
- Only create a single instance of quamash.QEventLoop

- Set the currently running event loop to support asyncio.get_event_loop().
  Using this code await asyncio.sleep(0.5) works in python 3.8 without
  explizitly passing in the event loop - which is deprecated and set to be
  removed in python 3.10. (Idea from gmarull/asyncqt#13)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Python 3.8] RuntimeError: no running event loop Support get_running_loop()
2 participants