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
1 vote
1 answer
84 views

Python asyncio - How do awaitables interact with system-level I/O events (e.g., serial ports)?

I’m learning asynchronous programming in Python using asyncio and want to understand how low-level awaitables work, particularly for system events like serial port communication. For example, ...
Eledwin's user avatar
  • 75
1 vote
1 answer
45 views

Asynchronously running a function in the background while sending results in Python

I have a Python script which I would like to a) Continuously listen for requests from an API, and b) Run an expensive algorithm continuously in the background. The results from the algorithm are saved ...
Adam's user avatar
  • 389
0 votes
0 answers
37 views

SFTP File transfer performance using Paramiko vs Asyncssh

I am comparing 2 different methods to download files from a sftp server. Using Paramiko.Transport(), adjusting the buffer size and downloading the file in chunks Using Asyncssh, also adjusting the ...
user29818860's user avatar
0 votes
0 answers
49 views

Asyncio async funcitons hangs with asyncio.gather. (the code works without asyncio.gather)

The following code runs well if did not put the async functions inside a asyncio.gather and let them run one after another (with awaits). But when I add them to an asyncio.gather, it prints "...
Tharusha Jayasooriya's user avatar
0 votes
2 answers
99 views

Gracefully terminate `asyncio` program in Python with a full queue

The Problem I have a simplified example of an asynchronous program (Python 3.9) that is not working when exceptions are raised in futures, and I am looking for ways to gracefully terminate it. In ...
J.K.'s user avatar
  • 1,615
1 vote
1 answer
78 views

How to "swallow" python's asyncio library's TimeoutError exception

I have a python script that connects to a server and downloads a large amount of videos and photos. And when I say large, I mean in the tens of thousands. The total amount of data to be downloaded ...
mtrojak2's user avatar
  • 123
0 votes
3 answers
83 views

Why CPU bound task doesn't block asyncio event loop?

I want to go deep in asynchronous task execution in python and I made experiment when CPU Bound task runs with IO bound task simultaneously. I suppose that CPU Bound task blocks the event loop and IO ...
Philipp's user avatar
  • 29
0 votes
1 answer
70 views

ProcessPoolExecutor() with asyncio hangs randomly

I have an async service that processes data. My current approach is to process different folds created using TimeSeriesSplit in parallel, since this is a CPU heavy task I decided to uses concurrent....
Ahmed Troudi's user avatar
1 vote
3 answers
85 views

How to run async code in IPython startup files?

I have set IPYTHONDIR=.ipython, and created a startup file at .ipython/profile_default/startup/01_hello.py. Now, when I run ipython, it executes the contents of that file as if they had been entered ...
odigity's user avatar
  • 8,306
1 vote
3 answers
101 views

Why the async-code is printing these things and in this order?

I'm trying to understand asynchronous programming in Python, and I've stumbled to see the output of the code import asyncio async def my_coroutine(): print("Coroutine started") ...
ankit's user avatar
  • 13
0 votes
2 answers
521 views

I can't understand what's wrong with my loop/asyncio when trying to run a telethon script

I can't understand what's wrong with my loop/asyncio when trying to run a telethon script I've tried multiple approaches, but I constatly get errors when trying to run the client with asyncio - so ...
user28854634's user avatar
0 votes
2 answers
287 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
44 views

Any difference between await asyncio.Task and asyncio.Task.result()?

After the task already completed, is there any difference between await asyncio.Task and asyncio.Task.result()? The only difference in the following code is how I read the value in task. import ...
pegasus's user avatar
  • 85

15 30 50 per page
1
2 3 4 5
77