Skip to main content
1 vote
1 answer
49 views

Python script locked by thread

I would like this Python 3.10 script (where the pynput code is partially based on this answer) to enter the while loop and at the same time monitor the keys pressed on the keyboard. When q is pressed, ...
BowPark's user avatar
  • 1,534
0 votes
1 answer
65 views

Thread leakage issues during code testing

When performing OCR on user-selected regions using PaddleOCR, certain regions fail to be detected. The issue occurs in a Streamlit-based application with the following implementation characteristics: ...
Big-Yellow-J's user avatar
1 vote
1 answer
63 views

Is the Python ThreadPoolExecutor best used for synchronous database calls?

I need to connect to several different databases and then perform a number of queries on each one. I first tried to use asyncio until I realize that JDBC doesn't have async calls, and wrapping the ...
Bert's user avatar
  • 11
0 votes
0 answers
30 views

Why does tqdm mess up cProfile output?

When profiling some Python code, I've been frustrated by functions like threading.py:637(wait) appearing high in cProfile output instead of the hot functions I want to see. After some tests I realized ...
Imperishable Night's user avatar
0 votes
0 answers
40 views

How to exit a Python Win32 GUI program on Ctrl-C from invoking console

I have a simple Python Win32 program that works well when run under pythonw from a command prompt. When I run it under python, it keeps running in the foreground of the command prompt and can e.g. ...
SRobertJames's user avatar
  • 9,245
0 votes
0 answers
43 views

Unpredictable behaviour when reading from stdin in python daemon thread

The python documentation says of daemon threads: A thread can be flagged as a “daemon thread”. The significance of this flag is that the entire Python program exits when only daemon threads are left. ...
pjones123's user avatar
  • 406
0 votes
0 answers
37 views

Launch only one background task with multiple Gunicorn workers

I have a flask application that I run with Gunicorn. The application itself would ideally be run with multiple workers. I also have some data I need to consume from Kafka, but that should only be one ...
Vincent Guttmann's user avatar
0 votes
1 answer
64 views

comparative analysis of multithreading and multiprocessing

i would like to compare to each other python's multithreading and multiprocessing, here is example of multithreading : import numpy as np import threading import time ...
rain snow's user avatar
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: ...
Lesterth's user avatar
0 votes
0 answers
15 views

Is there a way to interrupt speech in pyttsx3?

I've tried emptying the queue every time. I've tried self.engine.stop. It either doesn't affect anything or it will work and successfully interrupt the previous speech one, twice or maybe even thrice ...
DRags's user avatar
  • 56
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')]] ...
Branc's user avatar
  • 1
0 votes
1 answer
53 views

Background threads stoping

i have a python application, that contains functions to be called by interval. def call_repeatedly(interval, func, *args, **kwargs): stopped = threading.Event() lock = threading.Lock() # Lock ...
Pythonaire's user avatar
0 votes
1 answer
59 views

How do I preserve and reconcile mutable object state across parallel tasks, when pickling breaks references in Python multiprocessing?

We're working on a concurrency problem where a single "Sample" object has multiple dependent tasks that must be executed in stages. For instance, stage 1 has tasks (1a, 1b), stage 2 has ...
NanoNerd's user avatar
  • 132
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 ...
debabrata-aic's user avatar
0 votes
1 answer
37 views

Stop thread flow (audio) by condition in Python

There are streams: music - plays music, run - asks to enter something. I want that if "r" is entered, the music stream is interrupted by this condition. I understand that the flag with the ...
Кирилл Маликов's user avatar

15 30 50 per page
1
2 3 4 5
276