Skip to main content
Filter by
Sorted by
Tagged with
2 votes
1 answer
81 views

I created an agent using Langgraph in Python, and I developed a tool for them to save a todo in a database. But that tool doesn't work and raises an error! I use SQLAlchemy to connect to the DB. This ...
Emad Deve's user avatar
  • 115
0 votes
0 answers
31 views

I'm building a real-time dashboard using FastAPI WebSockets + Kafka. Everything works perfectly for a single user, but when multiple users connect, only the most recently connected user receives ...
PRANAV K P's user avatar
0 votes
1 answer
54 views

I am trying to pipe multiple Linux commands and abort if there is an error. With Popen the communicate() method waits for all commands to finish. This is why I am trying asyncio now. I have the ...
Manuel Schmidt's user avatar
0 votes
1 answer
82 views

Previously I had a question on an example of multiprocessing which you can see in the following link I used a 2 workers pool to split a sum in a function with Python multiprocessing but the timing ...
AmirHosein Sadeghimanesh's user avatar
2 votes
1 answer
75 views

For some reason, this code doesn't work on Ubuntu 20, Python 3.8.10, unless the .gather line is commented out. It works on Ubuntu 24, Python 3.12.3 and Windows 11, Python 3.13.9. It doesn't work on ...
WorkerZ's user avatar
  • 23
1 vote
1 answer
55 views

How to make exceptions thrown from a socket server running in a task group task be propagated up to its parent TaskGroup? With given example, I'd expect to see the error raised from ...
laur's user avatar
  • 608
3 votes
2 answers
85 views

I am using Python 3.13.2. I am going through the Python asyncio tutorial here. At around 10:20 timestamp, the instructor shows an example of asyncio.gather with a coroutine accepting a Future. Here is ...
Amit Tendulkar's user avatar
1 vote
0 answers
80 views

How would I be able to start a multiprocess when one of the tasks uses Asyncio and another task uses a subprocess to run? Here is the main function: import asyncio import aioprocessing import ...
Andrew Ryan's user avatar
  • 1,631
Best practices
0 votes
2 replies
76 views

No matter how much I search (or maybe I'm searching incorrectly), I can't find a decent way to terminate my tasks in Python AsyncIO. I know what: - I need to bind to signals (SIGINT, SIGTERM) using ...
Uoyroem's user avatar
  • 23
2 votes
1 answer
65 views

I have a long running Python application built on asyncio. It launches several background tasks that run indefinitely and occasionally performs CPU work using asyncio.to_thread. Everything works fine ...
efenatuyo's user avatar
Advice
1 vote
5 replies
147 views

I understand that: await some_async_function() doesn't yield control - it just calls the function synchronously await some_io_function() DOES yield control to the event loop But what's the actual ...
Varun Gawande's user avatar
5 votes
2 answers
123 views

I have a long running task which is executing a coroutine that calls asyncio.sleep() with a large value. In another task I need to know how much longer the long task will sleep. I can get the long ...
User123456's user avatar
0 votes
1 answer
98 views

I’m building a data ingestion pipeline in Python that collects data from a third-party REST API. The API allows a maximum of 100 requests per minute, and I need to fetch data for tens of thousands of ...
Swati's user avatar
  • 214
2 votes
1 answer
101 views

I am having difficulties integrating asyncio with Pyside. What I want to acheive: I have several emitters (up to 30) sending messages independently every few milliseconds (200ms) in multicast. I have ...
Antoine101's user avatar
1 vote
1 answer
110 views

I'm trying to make a bunch of HTTP GET requests to different endpoints of the same API. My understanding is that asyncio helps me manage concurrent I/O operations efficiently, meaning when one network ...
drawfine's user avatar
4 votes
1 answer
93 views

There are two tasks in a task group. One of them raises, the other one should be cancelled. This works fine in Python 3.12+, but freezes in Python 3.11. Older versions did not support task groups. Is ...
VPfB's user avatar
  • 18.1k
1 vote
0 answers
107 views

I keep getting a timeout error which I can't currently explain. I'm new to networking in Python, but I can create and interact with example websocket code. For some reason the code below hits a ...
mathPhys's user avatar
2 votes
1 answer
65 views

After starting a spider, there is the problem with freezing on a stage when pipeline must enable. There is no errors, just scrapy-playwrigth script, but it stopes on beggining before even starts ...
Max Plakushko's user avatar
7 votes
2 answers
361 views

The following code works fine on Python 3.13, but fails on Python 3.14 with a RuntimeError related to asyncio tasks. If I switch the multiprocessing start method from "fork" to "spawn&...
DarkMath's user avatar
  • 1,510
1 vote
1 answer
73 views

I'm testing a FastAPI application with asynchronous endpoints using pytest and httpx.AsyncClient. I have an endpoint /logout that depends on a JWT token from cookies and uses some async dependencies. ...
onesch's user avatar
  • 21
-2 votes
1 answer
57 views

I'm trying to connect to Mega.NZ via module https://pypi.org/project/mega.py/ with this code: #!/usr/bin/env python3 from mega import Mega mega = Mega() m = mega.login("my mail", "my ...
user216652's user avatar
-2 votes
1 answer
129 views

I am working with Asyncio in an app I am making. However, I find it daunting to prefix my function calls with await. So I want to encapsulate it in a decorator that adds the wait to the function call. ...
Ephreal's user avatar
  • 2,167
0 votes
1 answer
115 views

I was trying to start the asyncio REPL (python -m asyncio) and to execute a script before starting the interactive REPL (python -i ./script.py). I tried re-ordering of options, the end-of-options ...
VPfB's user avatar
  • 18.1k
2 votes
2 answers
96 views

I’m learning about asynchronous programming in Python and testing with asyncio. import asyncio import random async def worker(name): delay = random.randint(1, 3) await asyncio.sleep(delay) ...
Anuj Mishra's user avatar
0 votes
2 answers
111 views

I’m running into an issue when using asyncio.run together with SQLAlchemy (async) inside a Celery task. When I call the function the first time, it works fine. On the second call, I get: RuntimeError: ...
hhhscvx's user avatar
0 votes
1 answer
46 views

class FGAClientWrapper: """ A synchronous, gevent-friendly wrapper for the async OpenFGA SDK. """ def __init__(self, call_timeout: float | None = 10.0): ...
vaibhav's user avatar
  • 18
2 votes
2 answers
156 views

I'm working on an asynchronous server using asyncio, but I need to monitor a multiprocessing.Event (used to signal termination from another process) inside my async event loop. Here's the simplified ...
UnemployedBrat's user avatar
4 votes
3 answers
250 views

I'm writing tests for my fastapi application that uses asynchronous posgtres connection: # backend/database/session.py from sqlmodel import SQLModel from sqlmodel.ext.asyncio.session import ...
Daniel's user avatar
  • 1,025
1 vote
2 answers
86 views

In the following code snippet, runner takes an optional semaphore. If this semaphore is provided, then all coroutines will be wrapped to handle entering the semaphore's context manager. If I raise an ...
cjp94's user avatar
  • 63
1 vote
4 answers
97 views

There is something I can't understand in this code import asyncio async def fetch_data(param): print(f"Do something with {param}...") await asyncio.sleep(param) print(f"Done ...
M a m a D's user avatar
  • 2,189
2 votes
1 answer
130 views

I'm running some serial commands to test connected devices under test (DUTs), & we have a need to run these in parallel/concurrently to speed up our tests. I would like some feedback on which ...
frimann's user avatar
  • 189
4 votes
3 answers
180 views

I'm experimenting with asynchronous patterns in Python and was curious what happens if I define a __del__ method using async def in Python 3.12. For example: class MyClass: async def __del__(self):...
LucasL's user avatar
  • 1
0 votes
1 answer
240 views

I am trying to create a ReAct agent in LlamaIndex using a local gpt-oss-20b model. I have successfully loaded my local model using HuggingFaceLLM from llama_index.llms.huggingface and it seems to be ...
meysam's user avatar
  • 194
2 votes
1 answer
89 views

I would like to optimize my current function called process_coordinates. import asyncio from aiohttp import ClientSession from tqdm.asyncio import tqdm import pandas as pd from streetlevel import ...
Daniel AG's user avatar
  • 121
0 votes
1 answer
71 views

I have a maddening bug that makes it look like my code is hanging inside an asyncio.sleep() call. ie. while condition: print("Before Sleep") await asyncio.sleep(0) print("...
sandyscott's user avatar
1 vote
0 answers
78 views

I’m working with the latest version of Pipecat and Pipecat Flows (0.0.18), and I’m trying to implement a pattern where the bot can continue interacting with the user while an async background task ...
Carlos C's user avatar
0 votes
1 answer
607 views

I’m developing a Discord bot in Python using Nextcord, with classic prefix commands. I want the bot to join a voice channel when a user sends a command. However, when running the voice join command, ...
PapierPain's user avatar
4 votes
3 answers
397 views

How can I throttle API requests in Python’s asyncio so that no more than 5 requests are sent per second, while still processing results as soon as they arrive? I’m working with an asynchronous HTTP ...
user avatar
0 votes
1 answer
100 views

I'm trying to run an async function inside a Jupyter Notebook using asyncio.run() like this: import asyncio async def my_task(): await asyncio.sleep(1) return "Done" asyncio.run(...
Salika Ansari's user avatar
3 votes
1 answer
85 views

I have a piece of code, that checks if the redis db has data updates and loads them to the memory. I want only one corouitine to execute this load. class MyService: def __init__(self): ...
Artem Ilin's user avatar
0 votes
0 answers
131 views

I'm developing a simple real-time voice bot using the OpenAI real-time API, specifically integrating with Semantic Kernel. The code is written in an async manner, and it initially works well. However, ...
Mattia Surricchio's user avatar
1 vote
0 answers
100 views

All versions are up to date: Windows 11, Python 3.13.5, Jupyter: IPython : 9.4.0 ipykernel : 6.30.0 ipywidgets : not installed jupyter_client : 8.6.3 jupyter_core : 5.8.1 ...
Google Gauner's user avatar
2 votes
1 answer
236 views

The goal is to download images from the URLs asynchronously. Here is the code for threading, which works fine: import requests import threading import os import time import concurrent.futures as ...
Daniil Yefimov's user avatar
0 votes
1 answer
82 views

I'm trying to implement a very basic sftp server in python with asyncssh to be used during a unittest. I want to use a custom path to set the root of the sftp server and it would be better to set a ...
Manuel Díaz Pozo's user avatar
2 votes
0 answers
177 views

I'm encountering a subtle memory leak in a Python 3.12 application using asyncio, specifically when combining contextvars with deeply nested TaskGroup structures. The issue only appears under high ...
user avatar
0 votes
1 answer
106 views

I'd like to send an http request, and then operate on its response: import requests s=requests.Session() .... (session setup...) .... (url and params setup...) .... r=s.get(url,params=params) print('...
Tom Grundy's user avatar
3 votes
1 answer
77 views

So I have a custom library, packaged with setuptools. In essence, it is a library that sends a lot of tasks to an API in parallel, thus concurrency is used with asyncio. So far, everyone has been ...
Julio Sanz Rodríguez's user avatar
3 votes
1 answer
60 views

PhaseMap is a python package I am trying to use, but the minimal working example in the tutorial isn't working: import phasemap as pm def phase(pos): x, y = pos return int(x**2 + y**2 < 1) ...
Kieran Cooney's user avatar
0 votes
0 answers
85 views

I am trying to reproduce CVE-2024-30251, a denial-of-service vulnerability in aiohttp (Python async web framework) that affects versions prior to 3.9.4. According to the advisories, this vulnerability ...
ADITYA UDAY UBALE's user avatar
4 votes
2 answers
2k views

I am running a simple FastMCP server locally via the following server side code: from mcp.server.fastmcp import FastMCP server = FastMCP( name="Example-FastMCP", streamable_http_path=...
Sumit's user avatar
  • 43

1
2 3 4 5
159