All Questions
293 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(...
0
votes
2
answers
289
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. ...
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 ...
-2
votes
1
answer
275
views
Running Python 3.12 asyncio tasks in parallel
What specifically needs to change in the Python 3.12 code below in order for each and every one of the calls to the write_to_file(linesBuffer) function to run in parallel instead of running ...
0
votes
1
answer
70
views
Is there an issue if two asyncio tasks, one reads and one writes, uses one single websocket at the same time?
I have the following simplified code:
import asyncio
import websockets
async def read_from_ws(websocket):
async for message in websocket:
print(f"Received message: {message}")
...
0
votes
1
answer
72
views
Stripe Python AttributeError: 'coroutine' object has no attribute 'auto_paging_iter'
An example in the Stripe Python library doesn't seem to work. The README says:
# .auto_paging_iter() implements both AsyncIterable and Iterable
async for c in await stripe.Customer.list_async()....
1
vote
0
answers
36
views
Keeping ainput prompt as last console line
(python >= 3.7)
I'm currently writing a library that extends functionality for guilded.py (discord.py-esque library) to the console.
One problem I'm currently having is keeping the prompt as the ...
0
votes
1
answer
128
views
Understanding coroutine and iscoroutinefunction in inspect python
Given a class which has synchronous methods but call asynchronous methods inside another class. When I am trying to call a synchronous method in a sync class, I am still getting coroutine was never ...
-1
votes
1
answer
265
views
Python asyncio.gather not really parallel? [duplicate]
So I am trying to understand the parallelism in asyncio.gather() function.
I have a FastAPI app that needs to upload 4 files to s3 at the same time.
I am using a local S3 for testing right now, so ...
0
votes
0
answers
88
views
WebSocket Closes Unexpectedly in TTS Service with Multiprocessing and Asyncio
I am developing a TTS (Text-to-Speech) service using multiprocessing and asyncio in Python. My main application integrates other components using queue.
However, I'm encountering an issue where the ...
0
votes
0
answers
105
views
Python request get Invalid param error when using data from websocket result
token_info_list = []
list_lock = threading.Lock()
async def subscribe():
global token_info_list
async with websockets.connect(pump_new_pair_url) as ws:
# Subscribing to token creation ...
0
votes
2
answers
329
views
When does coroutine in asyncio actually cedes the execution?
I am trying to do a deep dive into Python's asyncio module. I understand we need to await the coroutine to get their results and when we await any coroutine, the surrounding coroutine cedes its ...
0
votes
1
answer
542
views
ThreadPoolExecutor asyncio analogue?
I used to use concurrent.futures.ThreadPoolExecutor in my projects, running my synchronous functions in separate threads with it.
Nowadays I mostly use asynchronous code with asyncio, but I have a ...
1
vote
0
answers
247
views
Terminating an asyncio loop with RTL-SDR after N seconds
I'm building a function to allow a user to stream RTL-SDR data for N seconds.
Attempt 1
Currently, my script uses two functions, one of which monitors timeout conditions and signals the program to ...
1
vote
0
answers
52
views
How to call a route once in Fastapi and block calling it again (display a "process running" message) until execution completes
There is a need to wait for a function to be executed and to protect it from being called again. It is necessary to protect the route call from being called again; if the route is called again while ...