Linked Questions

225 votes
14 answers
357k views

I was wondering if there's any library for asynchronous method calls in Python. It would be great if you could do something like @async def longComputation(): <code> token = longComputation(...
Stefano Borini's user avatar
40 votes
6 answers
69k views

Background: I am hosting a flask server alongside a discord client The flask server just needs to pass on messages from the client to discord and from messages from discord to the client. I am ...
SuperKooks's user avatar
53 votes
3 answers
9k views

When implementing classes that have uses in both synchronous and asynchronous applications, I find myself maintaining virtually identical code for both use cases. Just as an example, consider: from ...
Grismar's user avatar
  • 32.4k
11 votes
1 answer
16k views

This seems like a common problem. See for example: Error "RuntimeError: This event loop is already running" in Python But in my case, I'm only starting the event loop once, at least as far ...
lhk's user avatar
  • 30.7k
9 votes
1 answer
9k views

I want to create a code that reads several pandas data frames asynchronously, for example from a CSV file (or from a database) I wrote the following code, assuming that it should import the two data ...
Yehoshaphat Schellekens's user avatar
2 votes
3 answers
5k views

(MRE in the bottom of the question) In tortoise-orm, we have to await on reverse ForeignKey field as such: comments = await Post.get(id=id).comments But in fastapi, when returning a Post instance, ...
Drdilyor's user avatar
  • 1,416
2 votes
1 answer
3k views

I am running Gremlin Python. Firstly, I did the installation in my local machine following these instructions here then I ran the code of this website here, but I got the following error at this bit: ...
Aureon's user avatar
  • 141
1 vote
1 answer
3k views

I'm trying to find a solution to call async function in a Synchronous context. And following is my references: Python call callback after async function is done When using asyncio, how do you allow ...
luochen1990's user avatar
  • 3,905
3 votes
1 answer
2k views

Let's assume I have a class that is used to perform I/O operations: class CommunicationStack: def __init__(self, socket): self.socket = socket def sync_get_data(self): ... ...
asikorski's user avatar
  • 942
0 votes
2 answers
2k views

recently I have been studying the application of Python's Package "aioftp" in order to download asynchronously some data from a remote server. So far, I have had no success in my efforts. ...
Philipe Riskalla Leal's user avatar
0 votes
1 answer
2k views

TL;DR: Q: How to lock protect a shared resource from a sync function in py39? Sorry if this was already answered - I just couldn't find it easily. I'm struggling how to correctly await a lock when ...
Steffen Schumacher's user avatar
0 votes
6 answers
2k views

I'm writing an API using ib_insync, Sanic and ngrok to forward webhook signals from Tradingview onto Interactive Brokers. It works on only the first attempt and the following error is thrown ...
needfulmeerkat41954's user avatar
0 votes
1 answer
977 views

I am making a discord bot using discord.py and I am using an event loop for my borrow command, but when I run it it gives me a bunch of error codes. The error code said that the loop is already ...
Geeson's user avatar
  • 17
4 votes
1 answer
555 views

Let's say I'm tasked with migrating a Flask project to an async Python webserver. I'm looking to for patterns to minimize the amount of work here. It appears to me, more or less, impossible to port ...
user48956's user avatar
  • 15.9k
1 vote
0 answers
2k views

I am unable to startup an arq worker in FastAPI even though i was able to create a redis pool and submit a task, but without an active worker, the task would not be executed. I called the Worker class ...
Oky's user avatar
  • 11

15 30 50 per page