Skip to main content
Stack Overflow
  1. About
  2. For Teams
Filter by
Sorted by
Tagged with
-3 votes
2 answers
72 views

I clearly have a fundamental misunderstanding of how async works. In Python 3.14, this snipped: import asyncio import asyncpg def adapted_async(): conn = asyncio.run(asyncpg.connect(...
1 vote
2 answers
52 views

I want to add a decorator on a FastAPI route like this: /admin/verification.py from functools import wraps import json def admin_required(admin_function): @wraps(admin_function) def ...
-1 votes
0 answers
39 views

I am writing a Python consumer for RabbitMQ Streams using an asynchronous library. I want to save the message offset to the stream server when the script is stopped (via SIGINT/Ctrl+C). However, the ...
2 votes
2 answers
70 views

I’m building a long-running background service in Python using asyncio, and I’m facing a memory usage issue that keeps growing over time. The service schedules multiple async tasks every few seconds, ...
Best practices
0 votes
2 replies
92 views

Context I have been programming in javascript/typescript a lot and now I have to write a program that opens a TCP connection and performs some data exchange tasks initiated by incoming messages over ...
1 vote
2 answers
93 views

I am using Python 3.13.2 I have async with connection.execute(query) as cursor: block in my endpoint, which I want to mock (connection is an object generated by await aiosqlite.connection(':memory:'). ...
-3 votes
1 answer
74 views

I run StartAsyncSerialServer from pymodbus and get a lot of debug output into my logfiles like: >>>>> recv: 0x11 0xc1 extra data: 0xfd 0xed 0xff 0x13 0x24 0x44 0x64 0xeb 0xa >>>...
0 votes
1 answer
101 views

When I run my code in normal way, my API endpoint returns 500. The problem is I cannot debug, as when I am running in debug mode and going line-by-line, it actually runs OK. The suspected piece of ...
0 votes
1 answer
79 views

I have a simple FastAPI server with just one WebSocket endpoint. It receives a terminal command, executes it locally, and broadcasts the stdout to the client every second: from fastapi import FastAPI, ...
-1 votes
0 answers
33 views

I have following code: import asyncio import time async def task1(): print("task1 start") time.sleep(2) # intentionally blocking print("task1 end") async def task2():...
0 votes
1 answer
50 views

I am using Python 3.13.2 I am trying a sample use case of using AsyncMock to simulate fetching of mock rows from DB to test my endpoint (using pytest-asyncio). I have also included a non-mock endpoint ...
1 vote
1 answer
94 views

I'm using asyncio.gather to run multiple coroutines in parallel. When one coroutine raises an exception, I expect the remaining tasks to be cancelled. However, they continue running. import asyncio ...
2 votes
1 answer
77 views

I’m experimenting with mixing asyncio and multiprocessing in Python 3.12. On Linux, the following code works as expected — the event loop stays responsive and the child process prints normally. On ...
2 votes
1 answer
131 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 ...
0 votes
1 answer
62 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 ...

15 30 50 per page
1
2 3 4 5
...
530

AltStyle によって変換されたページ (->オリジナル) /