2,209,247 questions
0
votes
1
answer
23
views
Input in if statements are hard
I have a question ovi, my question is about input() how do I make a input on a if statement block and make it about it for example a heads and tails game.
Advice
0
votes
0
replies
17
views
OCR in complex image
I need to extract player statistic in a image : enter image description here
I have try pytesseract with preprocessing image : convert to grey scale, resize img with a factor 2 and filter on edge :
...
0
votes
1
answer
55
views
Monitoring changes to variables programmatically
This is a follow up to my previous question about creating a debugger for C source files in Python. The current issue I am facing is monitoring changes to variables. I want to monitor 8 variables say ...
0
votes
1
answer
25
views
Streamlit Deploy: “Unexpected error” when setting App URL (even if optional field is empty)
I am trying to deploy my Streamlit app using streamlit.io cloud.
On the “Deploy an app” page, when I enter my GitHub repo, branch and main file it shows an Unexpected error under the “App URL” field.
...
-1
votes
0
answers
31
views
Python stack implementation for maze navigation with scoring (fixed capacity)
I am a university student working on a Data Structures lab about simulating maze navigation using a stack with limited memory.
The stack must have a fixed capacity of 25 moves, and the movement rules ...
0
votes
0
answers
35
views
Suitable Pandas installation on 32-bit Python (3.10, 3.11)
I am trying to use the Kiwoom OpenAPI (for making automated stock trading program), which requires a 32-bit Python environment. However, to successfully use Kiwoom Open API I need to set up pandas in ...
0
votes
1
answer
43
views
How to disable Celery startup logs?
I'm getting a bunch of logs like this:
[2025-11-29 16:13:15,731]
def group(self, tasks, result, group_id, partial_args, add_to_parent=0):
return 1
[2025-11-29 16:13:15,732]
def xmap(task, it):
...
2
votes
2
answers
67
views
Why does my Python program run twice when I execute it by double-clicking the .py file on Windows?
I’m learning Python and I noticed something strange.
When I double-click my Python file (.py) on Windows to run it, the program seems to run twice.
Here is a simple example:
print("Program ...
0
votes
1
answer
36
views
BeautifulSoup - Extracting content blocks after specific subheadings within a larger section, ignoring document introduction
I am scraping the Dead by Daylight Fandom wiki (specifically TOME pages, e.g., https://deadbydaylight.fandom.com/wiki/Tome_1_-_Awakening) to extract memory logs.
The goal is to extract the Memory ...
-1
votes
1
answer
30
views
Specifying local relative dependency in requirements.txt
I'd like to import a local package with a relative path in Python 3.12. When I do so I get this error:
ValueError: non-local file URIs are not supported on this platform: ...
The local package is ...
-1
votes
1
answer
44
views
quotient check and pass on to main program
I'm writing a simple maths sketch. At this point I want to check if 2 random numbers, when divided, leave a quotient. If not then pass them onto the next part of the program. If the quotient is not 0 ...
-1
votes
0
answers
22
views
Dynamic Conditional Correlation (GARCH & Regime Switching) [closed]
I have been thinking about a new research project that I need to perform, Dynamic Conditional Correlation (with GARCH & Regime Switching) using financial data.
I need to know between MATLAB, ...
-1
votes
1
answer
28
views
Pygame Movement Stuttering
When I try to move Surface in Pygame, it seems to stutter in a weird way. Even when I use dt, the movement speed is not constant. Even thought FPS oscilate around 59-61, the Surface sometimes moves ...
0
votes
0
answers
43
views
Is it possible to connect to a local Python server using secure web sockets from a browser console on an HTTPS webpage?
We installed websockets for Python on macOS using this terminal command:
(.venv) a@as-MacBook-Pro dic % python3 -m pip install websockets
server.py:
#!/usr/bin/env python3
"""Secure ...
1
vote
0
answers
49
views
python numba calling problems
I was writing code for the simulation of the fluid dynamics of a layer of water. It has a function of solid_liquid_layer_angular_velocity_change:
def solid_liquid_layer_angular_velocity_change(
...
0
votes
0
answers
32
views
How to avoid per-process memory duplication when using rapidgzip with multiprocessing in Python?
I have a Python file:
from concurrent.futures import ProcessPoolExecutor
import tarfile, rapidgzip
def processNdjson(ndjsonName):
with rapidgzip.open(inTarDir) as myZip:
myZip....
-2
votes
0
answers
34
views
How to implement a fixed-size stack in Python to simulate maze movement with scoring? [closed]
I’m a university student working on a Data Structures lab where I need to simulate maze navigation using a stack.
The stack must have a maximum size of 25 and I need to track score based on actions.
...
0
votes
0
answers
43
views
How do I resolve version conflicts between installed Python libraries in a virtual environment?
I’m working on a Python project where I’m using multiple libraries like numpy, pandas, and matplotlib. After installing a new library (scikit-learn), I started getting version conflict warnings like:
...
-5
votes
0
answers
49
views
How do I preserve the order of keys when merging two Python dictionaries with conflicting keys? [closed]
I'm trying to merge two dictionaries in Python while not changing order, but also applying a custom rule for conflicts
d1 = {"a": 1, "b": 2, "c": 3}
d2 = {"b":...
0
votes
3
answers
61
views
How to modify mulitple columns applying if else to multiple pandas dataframe columns
I have a dataFrame with columns Age, Salary and others, if I used:
df['Age'] = df['Age'].apply(lambda x : x+100 if x>30 else 0)
Then I can modify the Age column with the if else condition. Also, if ...
0
votes
0
answers
32
views
How can I connect to HFSQL C/S using python on Linux?
I am trying to connect to a legacy HFSQL (HyperFileSQL) Client/Server database using Python (pyodbc) on a Linux Ubuntu machine.
I have followed the official documentation to install the specific ODBC ...
0
votes
0
answers
25
views
Text summarizer produces second half of exampe text rather than complete text summary in 2 sentences plus keywords. Where does the summary fail?Python
App.py runs and produces the spinner feature. However, it outputs the second half of the example wiki text file instead of producing a simple summary generated by the model.py script. App.py and model....
-8
votes
0
answers
52
views
Any ideas on how to make this more efficient? [closed]
I’ve been using Obsidian for a long time to organize my stories, notes, projects, and collections—books, manga, movies, code, basically anything I want to catalog. I love collecting and learning along ...
-7
votes
0
answers
32
views
"IndexError: list index out of range" when accessing 5th element of array of 3 items [duplicate]
Error I am getting:
IndexError: list index out of range
My code:
number = [1, 2, 3]
print(number[5])
I expected it to print the element at index 5.
I tried:
Checking my list.
Printing other ...
Advice
1
vote
4
replies
63
views
mypy complains about a missing optional module
I have a module (let's name it optional_module) that I want to be imported optionally, as it can be either present or absent. Now I do it this simple way:
try:
import optional_module
except ...
0
votes
1
answer
50
views
how to create a new client connection FROM the Server-side using python socket programming?
I'm using python socket programming to build a mock VPN service. the way I want it to work is that the server is launched, then the user client (Host-U) is launched. The Server should send a message ...
-6
votes
1
answer
72
views
Having trouble with an assignment that involves processing tuples containing a str and a set of integers [closed]
The Task
Write a program based on the following requirements:
The list must contain several tuples - each tuple should include:
one name
one set consisting of numbers
Select only the tuples where the ...
1
vote
1
answer
40
views
How to define an alias value for an enum member?
In Python, an enum member carries an underlying value, which can be obtained by reading the value attribute. Conversely, an enum member can be obtained from its value by calling the enum type.
class ...
Advice
0
votes
1
replies
28
views
Databricks - How to restrict the values permitted in a job or task parameter?
I have a notebook with a parameter set within it via a widget, like this:
dbutils.widgets.dropdown("My widget", "A", ["A", "B", "C"])
my_variable = ...
-6
votes
0
answers
87
views
Why does Python’s sorted() ignore my custom __lt__ method when sorting a list of objects? [closed]
I have a custom class in Python where I define __lt__ so that objects can be compared.
But when I try to sort a list of these objects, the ordering doesn’t follow my comparison logic.
Here is a ...
Tooling
0
votes
0
replies
33
views
Good packages for bounded Linear Quantile Regression?
I'm looking for a good package to train a linear quantile regression model, i.e. $\hat y = \sum_{i=1}^n w_i \cdot X_i$. With $x_i$ are the input features, and $w_i$ are the bounded trainable weights. ...
-2
votes
0
answers
27
views
sqlite3.OperationalError because Python thinks my table name is a column [duplicate]
I am trying to access the table in my game which is called tbl[savename]. But it thinks my table name is a column.
My code is:
def save_data(self, data):
conn = sqlite3.connect("dbInfo.db&...
Advice
0
votes
1
replies
74
views
How to solve CAPTCHA using Python when doing automated scraping
I am writing a scraper in Python and ran into a CAPTCHA on the login form. The site sometimes returns a regular reCAPTCHA v2 and sometimes hCaptcha. I tried to bypass this through Selenium, but ...
-2
votes
0
answers
46
views
CSV data not outputting from list comprehension after record count (for loop) [duplicate]
I've been tasked to manipulate a CSV file in Python. Set up a strip & split command to clean up the data, and it works:
with open("GLB.Ts+dSST_cleaned.csv") as csv:
header ...
1
vote
0
answers
39
views
How to show the streaming parts of a polars query using explain()?
I am trying to explain() a Polars query to see which operations can be executed using the streaming engine. Currently, I am only able to do this using show_graph().
From sources on the web, I see that ...
-8
votes
0
answers
79
views
Why is my LLM hallucinating even after using a multi-vector RAG pipeline with FAISS? [closed]
I implemented a RAG pipeline using:
OpenAI embeddings (text-embedding-3-large)
Multi-vector indexing (sentence-level chunks)
FAISS flat index
Top-k = 5 retrieval
Even after this, the LLM still ...
-2
votes
1
answer
108
views
Regular expressions for extracting text inside curly brackets [closed]
I'm working with some marked text and I need to extract information in order to use later. I want to use regular expressions from Python using the module re, but I can't construct the right expression....
Advice
0
votes
1
replies
70
views
How to read a large Python project (for example, a project of Deep Learning or Reinforcement Learning)
I've downloaded many Python projects about Reinforcement Learning from Github, but each takes me too much time to read.
It's easy to comprehend a simple Python project with only a few *.py files, but ...
-1
votes
1
answer
54
views
How to randomly select a pixel within a kernel and attribute its value to the center pixel? [closed]
In order to investigate whether the decisions of a CNN for image classification are predominantly driven by image regions related to relatively fine object features, I am looking for an image ...
-2
votes
0
answers
55
views
Fn-F6 is not received by python script when Fn-lock is disabled [closed]
I have a python script that listens for keypresses with keyPressEvent. It has handlers for most F# keys. These handlers are working and have not changed in years.
Now I'm trying on a relatively new ...
Advice
1
vote
1
replies
41
views
InterpreterPoolExecutor vs ProcessPoolExecutor
Python 3.14 introduced InterpreterPoolExecutor. How is it different from ThreadPoolExecutor?
Here are the ways they are similar:
Both can utilize multiple CPU cores
Both use pickle to share objects ...
0
votes
2
answers
52
views
Keep conda environment of parent bash session when start a new bash session
Suppose my current activated conda environment is py314 on Linux.
When I start a new bash environment from the current one,
no matter via command bash, screen, or start vscode from command line,
the ...
-5
votes
1
answer
78
views
Best way to extract a names from a string [closed]
I have a function that takes a string as an input and tries to extract the name and surname. It is a combination of NER and regex to try to extract the names present. Is there a better or more ...
0
votes
0
answers
42
views
Optimization Challenge in Hugging Face: Effcienntly Serving Muliple, Differently Sized LLMs on a Single Gpu with PyTorch [closed]
I am currently working on a Python based Gen AI project that requires the efficient deployment and serving of multiple LLMs specifically models with different parameter counts ( Llama-2 7B and Mistral ...
0
votes
1
answer
53
views
Python venv command failing on MacOS with Homebrew
I've been happily using python with venv for at least the last year. It now no longer works:
python -m venv .
returns the error:
Error: Command '['/Users/sejaques/bin/python3.13', '-m', 'ensurepip', '...
0
votes
0
answers
55
views
One long PDF page generation [closed]
I can't calculate right height for PDF page for it to be one long page without page breaks. In result there a bit of page on second page whatever the length of HTML really is. Different JS methods ...
Best practices
0
votes
0
replies
30
views
How can I set up an ETL process for DataFrames (dbt or alternative tools)?
Question: I'm currently working on a dashboard prototype and storing data from a 22-page PDF document as 22 separate DataFrames. These DataFrames should undergo an ETL process (especially data type ...
1
vote
0
answers
55
views
Negative narrowing of union type with TypeIs of TypeVar not working as expected in new mypy version
I recently upgraded mypy from 1.17.0 to 1.18.2
The following code was successfully validated in the old mypy version (1.17.0), but fails in the new one (1.18.2):
_T = TypeVar('_T')
class Foo(Generic[...
Advice
0
votes
0
replies
29
views
Is there any way to use theme colors in a Gtk4 DrawingArea?
In Gtk4, I want to plot something into a DrawingArea, and want the colors to depend on the theme. Since StyleContext is now deprecated from Gtk 4.10, how could this be achieved?
Gtk docs simply say &...
0
votes
1
answer
48
views
Issues with tuple comparison while using a specific class that bypasses comparison
During a current school project of mine, I came up with a specific sorting algorithm which I nicknamed parallel_sort. By giving it a list of integers and a list of dictionaries, it sorts the ...