Questions tagged [python-asyncio]

This tag is to be used for the asyncio Python package which provides mechanisms for writing single-threaded concurrent code. The asyncio package provides asynchronous I/O, event loop, coroutines and tasks beginning with Python 3.4.

0
votes
0answers
8 views

Is there a way to have a process async await the release of a multiprocess lock without blocking the event loop?

The point of the program is to launch a separate process that operates a web socket. The main process is meant to collect processed messages through a shared Queue. My idea was to make a shared ...
2
votes
2answers
46 views

How to create timer without freezing all processes?

Want to describe my task firstly. My aim is to create Discord bot that sends a particular message exported from .txt in chat with a time interval of N seconds therefore I'm currently trying to use ...
0
votes
0answers
30 views

Wait for Python async Event that's set by sync code - using FastAPI

I have a async web service (with FastAPI) that runs a sync background task. The idea begin the code is: The FastAPI async code receives a task request. This request has an Event flag It adds the ...
-2
votes
1answer
19 views

inserting values with session.execute via sqlalchemy [duplicate]

from sqlalchemy import schema,create_engine from sqlalchemy.orm import Session with Session(connect) as session: session.begin() try: def volInsert(apival): ...
0
votes
0answers
21 views

Wrapping a coroutine inside a function [duplicate]

I need to create an asyncio implementation of an existent class, but I have to preserve the syncronous interface. In other words I have to put some wrappers around the coroutines to make them callable ...
0
votes
2answers
18 views

asyncio.sleep required after cancelling tasks?

To test a man-in-the-middle tcp proxy I have coded an echo tcp server and a tcp client. After each one of the tests I want the proxy and the server to go down, to make sure each test starts on a clean ...
1
vote
0answers
26 views

Asyncio get with unique URLs slower than non-unique

I have an asyncio function which calls aiohttp.Clientsession to get json data from many (10,000) URLs (code below). During testing, I have simply been calling the async function with a list of urls: ...
0
votes
0answers
35 views

Why am I getting this error with Asyncio?

I'm getting this error after my code runs for a few minutes: future: <Task finished name='Task-1' coro=<timer() done, defined at c:\Users(my name)\Desktop\DiscordBot\roblox test copy.py:12> ...
0
votes
0answers
29 views

How to run asyncio scheduler for each sequence in a loop?

I have a job scheduler already working as script below, and also a cycle implemented to run a couple of functions for each app. However, as soon as the scheduler hits the proper time, it runs only in ...
-3
votes
0answers
25 views

Clients getting timed out when attempting to connect to the public websocket server (Python)

def first(request): PORT = 7890 print("Server listening on Port " + str(PORT)) async def echo(websocket, path): print("A client just connected") try: ...
4
votes
1answer
64 views

Python asyncio: how are tasks scheduled?

I'm new to Python asyncio and I'm doing some experiments. I have the following code: async def say_after(n, s): await asyncio.sleep(n) print(s) async def main(): task1 = asyncio....
0
votes
0answers
21 views

Remove item from Queue after a set interval

By now I've looked at many, if not all, of the asyncio / aiohttp rate limiters out there. They all failed to solve the rate limit that is imposed on the REST API that I'm trying to work with. The REST ...
0
votes
0answers
12 views

Python ASYNCIO Remote Console Session Not Behaving as Expected/Hoped

I'm trying to build an interactive network server for remoting in to console applications with asyncio. It uses asyncio.subprocess and redirects stdio to listener/writer tasks. Input comes in over the ...
1
vote
0answers
27 views

How to handle IO in discord.py

i am new to asyncio coding, i had a question about how to handle IO in the asyncio event loop. Given some sort of asynchronous IO stream or session (aiologger, asynchronous sqlalchemy), whenever I ...
0
votes
1answer
24 views

How to run multiple functions (input dependent on prev function) with python asyncio?

I have 2 dataframes which I need to process separately with replace() before merging them together. In my actual use-case, there are more functions to be applied to each dataframe before the final ...

15 30 50 per page
1
2 3 4 5
369