Skip to main content

All Questions

0 votes
1 answer
23 views

Asyncio: read new data from process stdout without blocking monitoring task

I write asynchronous process manager, and up till now I came up with this: import asyncio class AsyncLocalProcessManager: def __init__(self): self.process = None async def submit(...
IzaeDA's user avatar
  • 397
0 votes
3 answers
134 views

Converting Python socket server to Asyncio

I have already converted a multi-treaded HTTP proxy ran by a socket server into a single-treaded proxy ran by Asyncio. And, it works well for HTTP. However, when I try to reproduce the same with SSL ...
Juraj's user avatar
  • 70
0 votes
0 answers
39 views

Error processing SNMP request: Component value is tag-incompatible

I am trying to write a mock snmp server using pysnmp library in python. https://pypi.org/project/pysnmp/ I start the server using, python mock_snmp_server.py python --version gives Python 3.11.4 I ...
cs-dev's user avatar
  • 107
1 vote
1 answer
48 views

pyserial-asyncio client/server in Python 3.8 not communicating immediately

I'm learning python and asyncio and after having success with asyncio for a TCP client/server I took my first stab at creating a serial client/server using pyserial-asyncio running in bash on a ...
Ed Morton's user avatar
  • 206k
1 vote
2 answers
91 views

How to gracefully stop an asyncio server in python 3.8

As part of learning python and asyncio I have a simple TCP client/server architecture using asyncio (I have reasons why I need to use that) where I want the server to completely exit when it receives ...
Ed Morton's user avatar
  • 206k
0 votes
1 answer
46 views

datetime.strptime() is blocking asyncio.Queue.get() [duplicate]

In the following code datetime.strptime() is blocking asyncio.Queue.get() operation import time import asyncio from datetime import datetime from functools import partial def write(queue): data =...
Dinesh's user avatar
  • 1,880
1 vote
1 answer
57 views

Using a dict for caching async function result does not use cached results

BASE_URL = "https://query2.finance.yahoo.com/" DATA_URL_PART = "v8/finance/chart/{ticker}" async def fetch_close_price(aiosession: aiohttp.ClientSession, ...
SAK's user avatar
  • 148
0 votes
2 answers
95 views

Creating a stoppable background task in Python

I want to run some function in the background, but be able to shut it down at will. I tried a bunch of solutions, the most obvious of which is asyncio tasks: # Data source DataSource = Generator[int, ...
Docom's user avatar
  • 25
1 vote
1 answer
85 views

How to trace the caller of an async function in VS Code Debug mode when the call stack is lost?

I am debugging a Python async function in VS Code, and I have hit a breakpoint inside the function. However, the call stack in the debug panel does not show the parent function that called it. Since ...
maplemaple's user avatar
  • 1,765
0 votes
2 answers
143 views

How to flatten a bunch of asynchronous generators asynchronously?

I have a bunch of webpages to scrape, these webpages have addresses that differ only in page number thus can be processed in parallel using aiohttp. Now I am using an asynchronous function to process ...
Ξένη Γήινος's user avatar
2 votes
1 answer
101 views

Why is Python's IsolatedAsyncioTestCase so slow?

I'm working on writing test cases for some Python code that uses asyncio. I'm noticing a significant performance degradation when my test classes inherit from unittest.IsolatedAsyncioTestCase vs. ...
Mike's user avatar
  • 61k
0 votes
0 answers
118 views

How can I reuse the existing asyncpg connection pool?

asyncpg.pool should be created at the first request and then reused for the next groups of requests. After the first successful use of the pool, an error occurs during reuse. Environment: Windows 10 ...
Donchack's user avatar
0 votes
2 answers
286 views

Is it safe to create asyncio event loop in one thread and run it in another thread while having ability to cancel it from outside the thread (python3)

I want to know if it's safe to create an asyncio event loop in one thread and run the loop in another while having the ability to cancel it from outside the thread in which the event loop is running. ...
Jishnu's user avatar
  • 130
1 vote
1 answer
51 views

How to run dependence tasks concurrently with non-dependence ones, and tasks inside for loop?

I am learning asyncio and there is a problem of running a dependence task concurrently with non-dependence ones. So far I couldn't make it work. This is my code: import asyncio import random def ...
HienPham's user avatar
  • 1,030
0 votes
1 answer
217 views

Cannot access path in websockets.serve handler

I cannot find a way to access the path of a websocket connection, docs say Receiving the request path in the second parameter of connection handlers is deprecated. python version: 3.12.6 websockets ...
Harold Obasi's user avatar

15 30 50 per page
1
2 3 4 5
145