223 questions from the last 7 days
0
votes
0
answers
31
views
Displayed data disappears after successfully adding data to sqlite database
Please help me! I'm building a simple stock search app using Flask (backend) and plain HTML/JS (frontend).
When the user enters a ticker, the app:
Send a GET request to my Flask backend (/search)
...
-3
votes
0
answers
38
views
Python solution to extract all tables PDFs and save each table to its own Excel sheet [closed]
I’m working with around multiple PDF files (all in English, mostly digital). Each PDF contains multiple tables. Some have 5 tables, others have 10–20 tables scattered across different pages.
I need a ...
0
votes
1
answer
30
views
How to setup the QPlainText line-height in Python
I encountered a problem while using Pyton's QPlaintExt component: How do I set the line height of QPlainText? I've tried multiple approaches:
Method 1: Using QTextDocument with HTML (Guaranteed to ...
0
votes
1
answer
36
views
Subclass of Generic fails with AttributeError: object has no attribute '__parameters__' - using Generic when superclass does forward __init_subclass__
I have a setup like the following
from typing import Generic, TypeVar
T = TypeVar("T")
class ThirdParty:
def __init_subclass__(cls):
... # does not call super()
class Mine(...
0
votes
0
answers
46
views
install error on Mac OS: 'ios' file not found ... failed building wheel for pandas
I am running into a consistent error with the PyPI install of apache superset 6.0.0. I am following the instructions from https://superset.apache.org/docs/6.0.0/installation/pypi/.
pip install apache-...
0
votes
1
answer
53
views
Pip wont let me install --user any more, shows externally managed env error
I have used --user in the past to not have to deal with virtualenvs in the past, but I cant seem to do it now, presumably on a different python version..
$ pip install --user esphome
error: externally-...
Best practices
0
votes
6
replies
70
views
Is there a better way to map a user input to a list of possible replies than this function I cobbled together?
I have this function I came up with as a python noob that takes an "inputMap", a 2-dimensonal array as follows:
exampleInputMap = [
['1', 'a', -1], # do the first action
['2', 'b'], ...
-1
votes
0
answers
29
views
Markdown notation stored in DuckDB, displayed in the "Shiny" WebApp as mathematical expression
Using DataGrid (Data Grid – Shiny for Python), how can LaTex/Markdown notation, which strings are stored in the cells of a DuckDB database file, be displayed in the Shiny webapp as human readible ...
0
votes
0
answers
35
views
Local unit testing apache airflow
Cannot Run Apache Airflow Unit Tests: sqlalchemy.exc.OperationalError: unable to open database file
I am attempting to run a single unit test within the Apache Airflow repository (airflow-core/tests/...
0
votes
1
answer
45
views
How to form a new socket connection with multithreading in Python
The project I'm working on is a simulation/ mock up of a VPN service. I've figured out how to connect multiple clients to a single server using loops and multi-threading, but now I'm struggling to ...
2
votes
1
answer
40
views
Matplotlib LaTeX text not respecting font family
I am trying to display a LaTeX-style equation in a Matplotlib plot using a custom font (Algerian). I want both the equation and the surrounding text to use the same upright (non-italic) font. Using ...
0
votes
0
answers
45
views
Bug when nesting "for" on iterators [duplicate]
Consider this Python snippet:
range1 = range(3)
range2 = range(2)
print([(e1, e2) for e1 in range1 for e2 in range2])
This displays 3x2 = 6 tuples, as expected:
[(0, 0), (0, 1), (1, 0), (1, 1), (2, 0)...
0
votes
0
answers
44
views
Finding Python installations besides Apple pre-installed (possibly from Anaconda) [closed]
How do I check how many Python installations I have on my Mac?
I am currently runing Tahoe 16.0.1 and Python is already present on my Mac from Apple but I also installed Anaconda which came with its ...
1
vote
1
answer
49
views
logging file is always empty
Here is a snippet of how logging is done in my test script:
logging.basicConfig(
level=logging.INFO,
format="%(asctime)s %(message)s",
datefmt="%Y%m%d %H:%M:%S",
...
-9
votes
1
answer
64
views
What are the different ways to reverse a string in Python? [duplicate]
I am learning Python and want to reverse a string.
Example:
Input: hello
Output: olleh
I know slicing works (s[::-1]) but I want to know if there are other Pythonic or recommended ways to do it. Is ...
-5
votes
0
answers
39
views
Kurose Ross - Video Streaming Project [closed]
I happen to have a project on the video streaming using RTSP and RTP from Kurose Ross and I'm stumping on how to implement HD video streaming for this. I have basically made everything work (fill in ...
-2
votes
0
answers
34
views
Azure Function App (Python 3.11 on Linux) stopped detecting all functions after Flex Consumption update – even Basic plan does not work [closed]
I’m running into a blocking issue with a Python 3.11 Azure Function App on Linux.
Until this week my Function App contained three HTTP-triggered Python functions and everything worked perfectly. After ...
-5
votes
4
answers
92
views
Python while loop not stopping when element is found in a tuple [closed]
I am trying to search for a number in a tuple using a while loop in Python. The program finds the element , but it does not stop and continues to run until the end of the tuple. Here is my code:
...
0
votes
1
answer
64
views
PyTorch not recognizing RTX 5090 (sm_120) on Windows 11 – CUDA error: no kernel image available
I'm trying to use PyTorch with an NVIDIA GeForce RTX 5090 (Blackwell architecture, CUDA Compute Capability sm_120) on Windows 11, and I keep running into compatibility issues. PyTorch detects CUDA, ...
0
votes
0
answers
25
views
Apply dash-bootstrap theme to dcc components
I want the dash.dcc.Dropdown to look like the dbc.DropdownMenu in the bootstrap site:
This is my sample code:
# -*- coding: utf-8 -*-
from dash import Dash, dcc, html
import dash_bootstrap_components ...
0
votes
1
answer
43
views
Put all row from a data in a list
I am having a problem to put an entire row from data in a list
import pandas as pd
import numpy as np
import csv
df= pd.read_csv ("data.csv")
my_list = [] # list
for n in range(1, ...
1
vote
1
answer
43
views
How to create trigger on specific file change?
I'm using Buddy Works CI/CD. My use case is that I want to run auto evaluation via CI every time there is a push of changing a evaluation data file. I have tried a lot but fail. My current approach is ...
-4
votes
0
answers
47
views
Why does Python treat two identical string literals differently when modified inside a loop? [duplicate]
was experimenting with string handling and noticed something confusing.
In the following code, two identical string literals behave differently depending on where they are used:
s1 = "harsh"
...
0
votes
0
answers
35
views
How to break circular dependency in Python class when trying to separate a simple wrapper class from a heavier implementation?
I am trying to build a small scale deep learning framework. I defined my tensor class as follows
class Tensor:
__slots__ = (
"_backend",
"_data",
"...
0
votes
0
answers
27
views
How to share a large CustomObject to workers in Python multiprocessing on Windows (spawn)?
I'm trying to run calculations using multiple cores in Python on multiple platforms (Linux, macOS, Windows). I need to pass a large CustomClass Object and a dict (both readonly) to all workers. So far ...
0
votes
2
answers
71
views
Why is my instance variable not updating inside a Python class?
I am learning OOP in Python. I created a class and tried to update an instance variable inside a method, but the value doesn’t change.
class Student:
def __init__(self, name, marks):
self....
-5
votes
0
answers
65
views
Why is my list not updating when I use append inside a loop in Python? [closed]
I’m trying to add numbers to a list using a loop:
nums = []
for i in range(5):
nums.append(i * 2)
print(nums)
But the list prints [] instead of values.
Am I missing something basic?
How can I ...
Best practices
0
votes
6
replies
111
views
Why is my Python recursive function returning None instead of the expected value?
I wrote a simple recursive function to calculate the sum of digits of a number.
But instead of returning an integer, it prints None.
def digit_sum(n):
if n < 10:
return n
print(...
0
votes
1
answer
65
views
Refining reading words/chars from a file after a specified keyword, until a specified character is hit [closed]
I am trying to copy data from game files to my own files to mod said game, after some updates to the game I would need to rewrite one specific line on over a thousand files, however due to the mod ...
0
votes
0
answers
51
views
pymysql connect results in 'struct.error: unpack requires a buffer of 4 bytes'
Some time ago I had tried to install MySQL workbench correctly on my system, and it was a tremendous headache. This is because I use Kubuntu with a very new version of Ubuntu Release, and I had a lot ...
-1
votes
0
answers
41
views
Understanding Time Complexity and Space Complexity in Recursive Algorithms [closed]
I am trying to analyze and optimize recursive algorithms, particularly with regards to their time and space complexity. I have written a recursive solution for the Fibonacci sequence and a merge sort ...
-3
votes
0
answers
40
views
Detecting changes to dictionary keys in Python without continuous polling [closed]
I am working on a configuration manager in python that loads settings into a dictionary and updates them dynamically during runtime. The issue I am facing is detecting when keys inside the dictionary ...
0
votes
1
answer
50
views
Pyrogram does not recognize message_entities
I have a problem with forwarding messages with caption_entities. Attached below is the code that I use to make the transfer itself, as well as the result of its operation. The result shows that ...
Advice
3
votes
5
replies
91
views
Computing line intersection points on trapezoid-type grid
I need to compute ~2 million coordinates (64-bit float tuples)
They're the intersection points of lines that form a trapezoid-shaped grid (see visual below)
The shape of the trapezoid is different ...
2
votes
1
answer
52
views
Pyttsx3 only plays the first message of three
I'm trying to use Pyttsx3 to play three messages using text-to-speech. However, it's only playing the first message. How can I play all three? I'm currently using Python 3.11 on VSC
#Imports
import ...
0
votes
0
answers
30
views
How do I visualize the latent representation produced by the Stable Diffusion VAE?
I am trying to visualize the latent representation produced by the VAE inside a Stable Diffusion pipeline
from diffusers import StableDiffusionPipeline
import torch
# A CUDA ordinal is simply the ...
-3
votes
0
answers
63
views
Unable to pass variables to HTML using Flask [closed]
I'm trying to set up a webpage using Flask so I can pass Python variables to the HTML page. I created a test Python file with a page.html file inside a templates folder. I used the render_template ...
1
vote
2
answers
65
views
How do I code a CSS Selector to find a specific button, click on it, and wait until the webpage has completed the clicked task?
I have a working web scraper written in Python, Selenium and Chromedriver (all up-to-date version wise) and various other software packages. The target webpage has a field for the phone number, but ...
0
votes
0
answers
38
views
How can I run Flux2 inference on 2 GPUs?
I try to run Flux2 inference on 2 GPUs as follows:
import torch
from diffusers import Flux2Pipeline
from accelerate import PartialState
import argparse
from pathlib import Path
def main():
parser ...
-7
votes
1
answer
72
views
Trying to create a method to verify time [closed]
I'm new to python and i've been taking some courses to try and get the hang of it, as a proyect to challenge myself i tried to recreate a library method to check for borrowed books and etc. However i ...
-5
votes
0
answers
43
views
Why is my neural network overfitting even after using dropout and L2 regularization? [closed]
I’m working on a binary classification problem using a neural network in TensorFlow/Keras.
The dataset has around 9,500 training samples and 2,500 testing samples.
My model architecture:
model = ...
-4
votes
2
answers
79
views
Input in if statements are hard [closed]
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.
0
votes
0
answers
21
views
dearpygui and Dialog Popup
I want to show a popup dialog (for example, to warn the user about a duplicate file) in response to any callback—in this case, after selecting a file (or canceling) in a file dialog opened from a ...
Advice
0
votes
0
replies
29
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 :
...
1
vote
0
answers
107
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 ...
1
vote
1
answer
36
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.
...
0
votes
0
answers
53
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 ...
2
votes
1
answer
66
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):
...
3
votes
2
answers
92
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
48
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 ...