Skip to main content
Stack Overflow for Teams is now Stack Internal: See how we’re powering the human intelligence layer of enterprise AI. Read more >
Filter by
Sorted by
Tagged with
Advice
0 votes
6 replies
98 views

I am an amateur playing around with making simple games using Python and the Windows console through sys.stdout.write(). I am aware that this method of doing 'graphics' with printing ascii characters ...
RyanNewtonIV's user avatar
0 votes
2 answers
83 views

I am using Pycharm. When I click the "stop" button, the subprocess.Popen deletes the left over .bat files. But after putting the subprocess.Popen inside a threading.Thread function, the .bat ...
Rhys's user avatar
  • 5,408
4 votes
1 answer
124 views

I am developing an app to select and play a mp3 clip from a list. It will be run on a Pi4 with 7” touch display and piAMP+ hat. The GUI is in tkinter with pygame for the sound plus a pair of GPIO pins ...
Cheesehead's user avatar
3 votes
1 answer
278 views

Are python references atomic under concurrent access? Are dictionaries and lists thread-safe?
qouteall's user avatar
  • 113
-1 votes
1 answer
89 views

I am trying to start a Dialog including QListWidget. In this list every time a status is changed, the list should get a new line. At the end, if the backup process has finished, the dialog should ...
Stefan Bongers's user avatar
2 votes
1 answer
66 views

In this example, Tkinter GUI starts ThreadPoolExecutor. But ThreadPoolExecutor is inside a threading.Thread function. The thread function says it's finished before ThreadPoolExecutor has started ... ...
Rhys's user avatar
  • 5,408
0 votes
0 answers
49 views

I am running free-threaded python3.13t with PYTHON_GIL=0 on MacOS Sequoia 15.7. I create threads like this: thread = threading.Thread(target=lambda: time.sleep(10), name="test-thread") ...
Boris Burkov's user avatar
  • 14.7k
2 votes
1 answer
125 views

I'm running some serial commands to test connected devices under test (DUTs), & we have a need to run these in parallel/concurrently to speed up our tests. I would like some feedback on which ...
frimann's user avatar
  • 189
-1 votes
2 answers
133 views

We run a bunch of wireless controllers (mc's) and I want to use the controller API to transfer firmware via TFTP to each controller in preparation for an upgrade (the API call needs to be run on each ...
Guy Goodrick's user avatar
2 votes
1 answer
2k views

I'm encountering a persistent issue where importing the sentence_transformers library on macOS causes my Python script to hang indefinitely. When the script hangs, the only output I see is a low-level ...
Akash Dubey's user avatar
0 votes
1 answer
43 views

I am running a gunicorn server with 1 eventlet worker through which I communicate with the FE via websockets. However, I also need to listen to an external pod running some code that will emit a redis ...
Aitor Gastaminza Unanue's user avatar
0 votes
1 answer
94 views

I am using asyncio.StreamReader to continuously process line based communication like this: reader, writer = await asyncio.open_connection(host, port) while running: line = await reader.readline() ...
Dragoner's user avatar
  • 155
-1 votes
3 answers
80 views

I am running a script that listens for webhook on my local machine using the following pattern : from flask import Flask, request, abort app = Flask(__name__) @app.route("/", methods=["...
Sahasi's user avatar
  • 3
0 votes
2 answers
62 views

I have a Python function decorated with a 1-minute timeout. Inside it I spawn one or more worker threads that each run a 2-minute sleep via a dynamically executed script (using exec() in a custom ...
Vikash Rajput's user avatar
8 votes
2 answers
542 views

I'm working on an asynchronous Python application (using FastAPI/Starlette/asyncio) that needs to offload synchronous, CPU-bound tasks to a thread pool (ThreadPoolExecutor) to avoid blocking the event ...
Hemanth Hema Surya's user avatar
2 votes
1 answer
89 views

I'm writing an app that generates a live histogram to be displayed in a Tkinter window. This is more or less how the app works: A Histogram class is responsible for generating the embedded histogram ...
9iovaferra's user avatar
0 votes
3 answers
92 views

Yet another question about tkinter terminating... Here is a minimal code : import threading,tkinter,random class MiniTk : done = lambda self : self._quit.is_set() spot = lambda self,x,y : ...
Captain'Flam's user avatar
1 vote
1 answer
85 views

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,544
0 votes
1 answer
82 views

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
2 votes
1 answer
67 views

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
54 views

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,367
0 votes
0 answers
62 views

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
53 views

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
0 answers
39 views

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
21 views

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
20 views

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
-1 votes
1 answer
66 views

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
2 answers
89 views

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
  • 142
0 votes
0 answers
411 views

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
45 views

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
0 votes
1 answer
85 views

I would like to implement changing cursor in PyQT(PySide6) application. Since didn't find animated gif support for QCursor -> decided to create my own manual animation. So far: When change cursor ...
DDV's user avatar
  • 13
2 votes
1 answer
136 views

I'm looking for a way to track a multiprocessing task with Tkinter progress bar. This is something that can be done very straightforwardly with tqdm for display in the terminal. Instead of using tqdm ...
Mark's user avatar
  • 1,172
0 votes
1 answer
117 views

Initializing hugging face transformer causes loops to restart. I have created simple loop which reads text and replies but the loop is restarting new thread when initalizing chatbot pipeline. Minimum ...
Shahir Ansari's user avatar
0 votes
1 answer
48 views

I want to create an idle game, but I can't figure out how to get the system of "Money per second" to work. The idea is to have a main function that takes input from the user and another ...
HelloLearnerC's user avatar
0 votes
0 answers
72 views

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 ...
mysh's user avatar
  • 118
0 votes
1 answer
133 views

I am in a situation where I have a primitive REPL with some simple commands. These commands generate data and put the data into a threadsafe queue. I then have a function that takes the data from the ...
Angelo's user avatar
  • 3,165
2 votes
1 answer
129 views

I am trying to create small examples using Locks to demonstrate the issues that Locks will resolve in a multi-threaded environment. The example I created is the following, import threading # Shared ...
memelord23's user avatar
0 votes
1 answer
153 views

Here is the keyboard and mouse listener part of my code: python def mouse_listener(scroller): """Listens for mouse scroll events to scroll clipboard history.""" ...
E-Gamma-102's user avatar
0 votes
0 answers
29 views

I am trying to implement the shared memory database. The objective is to allow non-blocking reading access to the database for the IPC among threading. The setting is following def __init__(self): ...
kusocodeing's user avatar
1 vote
1 answer
107 views

How does Python ThreadPoolExecutor switch between concurrent threads? In the case of the async/awaint event-loop, the switching between different pieces of the code happens at the await calls. Does ...
Petras Purlys's user avatar
0 votes
2 answers
482 views

I want to use ThreadPoolExecutor to parallelize some (legacy) code with database access. I would like to avoid creating a new database connection for each thread, so I use threading.local() to keep a ...
Eugene Yarmash's user avatar
0 votes
0 answers
427 views

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 ...
me.at.coding's user avatar
  • 18.4k
1 vote
2 answers
43 views

I'm doing concurrency using Multiprocessing() and Threading(). The idea is to spawn multiple threads from multiple process. The threads needs to access global variable that use Value() so that ...
Guild's user avatar
  • 11
0 votes
1 answer
79 views

Ask please why press Ctrl + C ( KeyboardInterrupt) does not work as expected. (the process is not interrupted, continues to work) from concurrent.futures import ThreadPoolExecutor def sleeper(n): ...
Vitaliy's user avatar
  • 15
0 votes
0 answers
38 views

I'm having an issue with a Flask application that I'm running using Apache and WSGI on a Raspberry Pi. The application restarts intermittently, and it seems that Apache is restarting the application ...
eder1807's user avatar
0 votes
3 answers
50 views

I have some program that communicates with the user. The program should terminate when the user has entered a sample text. import time import threading def printer(): while True: print(&...
Stupid Hub's user avatar
1 vote
0 answers
43 views

I'm building a program that upload regurlarly videos on a google drive where I use them. The thing is, I have to refresh often the tokens by manually clicking and I don't want that. I built a function ...
La Poubelle's user avatar
1 vote
1 answer
180 views

Is a lock necessary in a situation where thread 1 checks if a bool has flipped from False to True periodically within a loop, the bool being updated in thread 2? As I understand a bool is atomic in ...
Hugo Schongin's user avatar
-1 votes
2 answers
118 views

From what i know if u divide a large task into multiple processes the time taken to complete the task reduces but this is not happening in my code. from multiprocessing import Process import time ...
Samyak Shah's user avatar
-1 votes
1 answer
39 views

I'm developing a two-player multiplayer game with pygame. Here is the server code and client code: <Server Code> import json import pygame # Main module for the game import pyautogui # For ...
이관우's user avatar

1
2 3 4 5
83