All Questions
Tagged with python-asyncio python-multithreading
197 questions
0
votes
0
answers
32
views
The set_result() of Future doesn't end the await after the loop of create_task()
I write a Python program involving a loop of create_task() that calls async functions. In each task, it waits for another thread to set the result for a Future object.
async def run(self) -> int:
...
0
votes
0
answers
17
views
PySimpleGUI - working of two windows at the same time [duplicate]
I have a project using the PySimpleGUI library. The application has many windows. The project is built as follows:
def window_nr_2():
layout2 = [[sg.Button ('But A'), sg.Button ('But B')]]
...
0
votes
0
answers
133
views
How to read data from Siemens S7-1500 PLC asynchronously using Python and snap7?
I am trying to read data from a Siemens S7-1500 PLC in an asynchronous way using Python and the snap7 library. My goal is to read multiple tags concurrently. However, I am encountering the error b'CLI ...
0
votes
0
answers
66
views
Interface between threaded and asynchronous parts of an application in Python
I'm helping develop a Python application which collects data from several sensors and manages a server to send those data to a web application (React) to display. The application is supposed to work ...
0
votes
0
answers
226
views
await asyncio.to_thread blocks complete event loop?
I am trying to create a Python program that - when triggered via a websocket - does some blocking work in a thread. I would expect my program to be able to continue to react to the stop signal also ...
1
vote
2
answers
134
views
How to call an async function from a child thread using asyncio.run_coroutine_threadsafe() and the main thread's loop? [duplicate]
I have an application that runs using async/await everywhere. Often, it calls out to functions that are synchronous. Those functions sometimes have to call asynchronous functions again. I am trying to ...
1
vote
0
answers
489
views
How can I run/start an async periodic task in the background in FastAPI [duplicate]
Assuming to have a list of Callable async tasks and I wish to run them in a background with a periodic timing. How can I design this with FastAPI?
In my toy example I tried the BackgroundTasks but as ...
-1
votes
1
answer
71
views
how do i correctly run an async function outside of another async function?
been having problems with my preloader, and someone suggested this:
async def setupPreloader():
global preloader
preloader = None
preloader = await songsFind()
asyncio.run(setupPreloader())...
0
votes
0
answers
203
views
How do I properly implement the python-can library's BLFWriter and Notifier for real-time tasks?
I am working on a tool that utilizes CAN buses to send and receive messages to and from a controller that I need to constantly monitor. A previous implementation of the code uses a loop to directly ...
0
votes
0
answers
17
views
Jupyter Colab Not Updating UI with background task or thread
I'm running a small POC to see if the ipython display can be updated in the background with a task or thread using below sample code.
The UI is updating when the slider or the button was invoked but ...
0
votes
1
answer
146
views
Why threading is much faster than asyncio when processing multiple files in my case
I'm experimenting with asyncio and threading to figure out which mechanism I should choose in processing a large number of files. The experiment is simple that I just want to read the files and add ...
1
vote
1
answer
173
views
Is asyncio in Python user-level threading model, cooperative scheduling?
I have been working for a long time with asyncio in Python, however I would like to clarify some thoughts on how asyncio actually works. I will break down my thoughts so that I can give context and ...
0
votes
0
answers
27
views
Execution Python coroutine as background task in new Thread [duplicate]
I've code which looks like this way:
class Service:
async def publish(file_obj):
"""Sending file_obj to s3"""
def render_pdf(data: dict):
&...
0
votes
5
answers
152
views
Why is threading.Condition.notfiy_all not trigger that a waiting thread is continued?
With the following code, I want to show how to synchronize with a thread.
I want to have a separate thread that updates an image.
From these images, I want to have an asynchronous generator.
The ...
0
votes
1
answer
79
views
Python asyncio: Do I Need Synchronization Primitives for Shared Variables When Using run_in_executor with ThreadPoolExecutor?
I'm working with Python's asyncio and triing to understand the run_in_executor function with the default ThreadPoolExecutor to handle blocking tasks asynchronously. My concern is regarding accessing ...