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

Better asyncio handling in Python <3.7 using threading #364

Merged
merged 1 commit into from
Feb 22, 2021

Conversation

caronc
Copy link
Owner

@caronc caronc commented Feb 22, 2021

Description:

Related issue (if applicable): nvidia-sniper/103

Apprise leverages asyncio right out of the box (by default), which works perfect in most situations. Asyncio significantly evolved once Python v3.7 was released. The problem is that not everyone is using Python v3.7, and not everyone has adapted their tool sets to use the new asyncio approaches yet.

Users of Python v3.6 and lower can encounter an error when using Apprise if the application it was built under leverages threading. By default there is no event_loop that exists within a Python thread. This pull request attempts to detect these situations so that it can spin up a new event loop (similar to how Python v3.7+ would) making the Apprise experience/integration more developer/user friendly. This PR also eliminates any potential RuntimeError from occurring on these older versions of Python.

Checklist

  • The code change is tested and works locally.
  • There is no commented out code in this PR.
  • No lint errors (use flake8)
  • 100% test coverage

@caronc caronc merged commit 221e304 into master Feb 22, 2021
@caronc caronc changed the title Better handling of Python <3.7 asyncio threading Better asyncio handling in Python <3.7 using threading Feb 22, 2021
@caronc caronc deleted the asyncio-runtime-error branch February 22, 2021 19:25
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.

1 participant