question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Question: Running under aiorun or asyncio?

See original GitHub issue

Is there a way to figure out inside a task, if the loop runs under aiorun or pure asyncio?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
sphhcommented, Apr 9, 2021

I had the same idea to try to import aiorun and if that fails, assuming that I run under pure asyncio. But there is the edge case, that you have it installed, but still run the program under asyncio, e.g. by not importing it in the first place, simulating that it is missing. (I know, I know, that’s a messy way to check a program …)

Since I don’t like global variables and the function initiating the closing program is only two classes deep, I pass an argument through to it. But I like your Singleton approach! I’ll ponder to change to this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

cjrh/aiorun: A "run" function for asyncio-based apps ... - GitHub
creates a Task for the given coroutine (schedules it on the event loop),; calls loop.run_forever() ,; adds default (and smart) signal handlers for...
Read more >
How to use the aiorun.run function in aiorun - Snyk
To help you get started, we've selected a few aiorun.run examples, based on ... for i in range(10)) await asyncio.sleep(0.01) raise Exception("Stops the ......
Read more >
asyncio run or run_until_complete - python - Stack Overflow
run_until_complete () is that you're executing your code under the semantics close to those of the new asyncio.run , even on older Python ......
Read more >
Async IO in Python: A Complete Walkthrough
This tutorial is built to help you answer that question, giving you a firmer grasp of Python's approach to async IO. Here's what...
Read more >
module browser.aio - Brython documentation
This module supports asynchronous programming in Brython, using the keywords async and await . It replaces the asyncio module in CPython standard library,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found