341,059 questions
0
votes
0
answers
60
views
bridging python and C++, Fatal Python error: _Py_GetConfig: the function must be called with the GIL held
I am bridging python and C++, namely calling a python function inside C++ host model. I got an error that I failed to find any clue in the web. Please help! Any insight would be deeply appreciated!
...
-3
votes
0
answers
32
views
Algorithm that solves any linear programming problem in Python and that he graphs it in matplotlib [closed]
i need an algorithm in python that solves any problem of linear programmation, could help me with ideas?, that accept as input one: objective function, ie: coefficients, restrictions, operators, etc, ...
0
votes
0
answers
56
views
Why does PyQt5 block write access to another program ("server-based")?
I have been working to integrate a PyQt5 GUI with a third-party software from HighFinesse (makes wavemeters). I am using the minimal Python library here on Python 3.9 on a Windows 11 computer.
In ...
0
votes
1
answer
30
views
Remove or modify a native onchange method in Odoo 18
In one of its modules, Odoo has this small onchange method that is complicating my operation, since I don’t need it for my business logic and I’m trying to eliminate its behavior.
@api.onchange('...
0
votes
0
answers
24
views
PX4 log download over MAVSDK serial triggers failsafe when a new flight starts during download
I have a Jetson onboard computer connected to a PX4 flight controller.
Architecture:
a watcher process monitors flight state over mavlink-router TCP
(tcpout://127.0.0.1:5760)
after landing and a ...
Advice
5
votes
3
replies
90
views
Type narrowing a generic sequence argument in python
Afternoon,
Is it possible in python, given a function that takes a generic sequence of objects, to type it so that the list must be of only one type and not a union of multiple children?
for code like ...
1
vote
0
answers
64
views
How to resolve the error 'Failed to build 'protlib' when getting requirements to build wheel'
Upon trying install a library, i am getting this error. How to resolve this?
I am trying to install the library alphatrade in mac book ubuntu platform.
I have tried installing protlib separately, but ...
Advice
1
vote
3
replies
55
views
Type of the Variable to Store a Type Information of Another Variable
What is the type of the variable which stores a type information (such as 'int', ...) of Another Variable?
Best practices
1
vote
0
replies
33
views
Creating Nested Task Groups in Airflow-3
I have only 1-2 months experience with Airflow 3. This is mainly a question about high level structure and I'm trying to figure out what I'm doing wrong.
I attempted to create a DAG that does the ...
Advice
0
votes
2
replies
75
views
How to safely remap (resize) mmap in Python while other threads are reading?
I am building segment-based log storage system in python using mmap module in python.
I want to prioritize:
Zero copy as much as possible
Concurrent readers
dynamic growth of underlying file
...
-2
votes
1
answer
133
views
Automate the Boring Stuff with Python Chapter 4 Collatz Sequence
Just started learning Python and would like some clarity about why this specific code I made for this problem doesn't work, but this other code does. I'm having issues understanding how the code is ...
-2
votes
0
answers
102
views
Python: send an email - pywintypes.com_error: (-2147467260, 'Operation aborted', None, None)
I am attempting to implement a send email function in python 3.14.
I'm getting this error:
pywintypes.com_error: (-2147467260, 'Operation aborted', None, None)
at the code line:
mail = outlook....
0
votes
1
answer
80
views
How to use FastMCP 3.2.0 from_openapi() with an API protected with oAuth?
I have a REST API which exposes it's OpenAPI definition.
That API is authenticated (Bearer tokens, oAuth2 IDP).
I generated a python MCP server for this API using the openapi functionnality of FastMCP ...
Advice
2
votes
5
replies
81
views
Why do I get a TypeError when indexing a dictionary .items() result?
I am working with a dictionary in Python and trying to use the .items() function to get the key-value pairs. I saved the result in a variable l, but when I try to access the first element using l[0], ...
Advice
0
votes
5
replies
111
views
Python List Conflict with Boolean and Int value
I came across an interesting behavior in Python lists and wanted some clarification.
var1 = [1, 2.3, 67, 'New Value', True, 'Welcome', 6]
var1.remove(True)
print(var1)
Output:
[2.3, 67, 'New Value', ...
Advice
0
votes
2
replies
57
views
How to create a virtualenv in the terminal of macOS?
Im trying to setup the python and Django environment on my macBook air. Im doing it directly on the terminal of the computer but when I write "virtualenv" so I can create a virtualenv on my ...
1
vote
1
answer
78
views
TypeError: When RV is not a pure distribution, value variable must have the same type
From this article HERE, published in "PeerJ Comput. Sci." I took the last code (page 28):
import pymc as pm
import pytensor
import pytensor.tensor as pt
a = pm.Uniform.dist()
b = pm.Normal....
0
votes
0
answers
37
views
Maya - Python 3 - "Object not found" error for UI
I've started learning Python for the purpose of making rigging/animation tools in Maya (transitioning from 3D Animation to Technical Animation) and I've always had a good grasp of making functions but ...
Advice
0
votes
1
replies
44
views
The Best Way to Get the OS Type and Version?
I'm a student in KMOU, where the everyone (excp. me) uses Microsoft Windows (NT 10.x; Some still use Windows 10 yet!), while I use Linux only. And I'm asking, in order to prevent a collision when ...
Advice
0
votes
2
replies
55
views
QTableWidget.removeRow() returns -1 and unexpected UI behavior in PyQt5/PySide
I am developing an Inventory Management System using Python and PyQt5 (UI designed in Qt Designer). I’m facing a very strange issue with row deletion in a QTableWidget.
The Problems:
Index Issue: ...
0
votes
1
answer
55
views
How to make pysnmp stop at the end of a table?
I used this simple example to fetch data from a switch via snmp:
from pysnmp.hlapi import *
for (errorIndication,
errorStatus,
errorIndex,
varBinds) in nextCmd(SnmpEngine(),
...
Best practices
0
votes
0
replies
51
views
Implementing Deterministic Entity Resolution in a Multi-Agent RAG for Investigative Archiving
Body:
I am architecting a Forensic Data Audit system (Multi-Agent RAG) to analyze fragmented, large-scale archives. A critical bottleneck is maintaining Entity Resolution (ER) across millions of ...
Advice
0
votes
0
replies
63
views
Chudnovsky RAM optimization in python3
I search RAM optimizations for a chudnovsky pi approximation. My code is very fast (for 1e9, the program takes 11m34s, for 10e6, 0.21 s, and for 10e8, 50s) but with 16 giga of RAM, I'm quickly out of ...
0
votes
1
answer
50
views
How to create an app icon from a file in a python3 qt6 app?
Like the title says. I have a python3 tool that uses the Qt6 libraries to display windows on my MacOS machine and I would like to use a different app icon.
Everything I have found talks about ...
0
votes
0
answers
40
views
Why spidev.SpiDev() is creating an error on RPi 4b?
I have two RPi 4b boards and two NRF24L01 PA modules.
The goal is to connect two Raspberry Pi 4b boards via NRF to send and receive signals.
I am trying to follow this atricle.
I only changed from ...
0
votes
1
answer
40
views
Unsupported Unicode escape sequence
I am trying to create an embedding of text and store it in a Supabase table.
The columns are:
document -- Text (each chunk of text of a document)
chunk_id -- UUID
embeddings -- vector
doc_id -- UUID (...
0
votes
1
answer
150
views
UnicodeEncodeError: 'charmap' codec can't encode characters when writing to HTML
I have a pandas DataFrame that I wish to paste into an HTML document. The DataFrame contains Dingbat characters used as symbols to highlight values as good (checkmark), nearly bad (triangle), or bad (...
Advice
0
votes
8
replies
201
views
C++. 1 same object that can be one of multiple classes instances. From same object, calling a method present in 2+ classes with same name & interface
This question is mainly about how to work in C++, in a simplified way, with the situation about 1 same object obj_A that can be one of multiple classes instance, where in each of those multiple ...
Best practices
0
votes
3
replies
69
views
Looking for Easier Ways to Manage Data Objects with Value-Based Minimum Distribution Requirements (Distribution Constraints?)
Idea
I want to take a relatively large cache of data (108k items, 80 data points per item) and sift through it to grab items at semi-random and generate small pools of items. Each of the pools need to ...
Best practices
2
votes
2
replies
81
views
Best practice for managing magic strings in Django JsonResponse keys/values
I have a Django view that returns JSON responses:
def post(self, request, post_id):
post = get_object_or_404(Post, pk=post_id)
if post.is_pub_date_future():
return JsonResponse({
...
0
votes
1
answer
72
views
get unread chat messages from microsoft teams using graphs
I'm running progressive web app of teams on linux. I don't have an icon in systray, so no indicator someone sent me a message if i'm not face of the screen to see the notification (which expires in 2s)...
5
votes
1
answer
138
views
Why does python 3.13.8 raise an IndentationError when running in asyncio mode on the terminal
Using Python >=3.13.0 (tried 3.11.14, 3.12.10, 3.13.0, 3.13.8 and 3.14.0a5), when I try to run the terminal in async mode, it throws an IndentationError when I try to start an async with code block:...
0
votes
1
answer
136
views
Loading 32 bit DLLs in Win 10 Python 3.12
I am trying to load a 32 bit cdll which was trivial in WIn 7 Py27 32 bit:
driver = ctypes.cdll.LoadLibrary("VBridge.dll")
driver.Connect()
I have a thread with a module developer of msl-...
Advice
0
votes
2
replies
82
views
Is providing __call__ for enum members a good idea?
The big questions
I noticed I have the following questions, that couldn't be answered by searching the internet:
Is it a good practice / idea to make enum members callable?
(Note that I mean the ...
1
vote
0
answers
74
views
SentenceTransformer can't load all-MiniLM-L6-v2 – missing config_sentence_transformers.json
I'm trying to load the sentence-transformers/all-MiniLM-L6-v2 model but it fails with a missing file error.
Code
from sentence_transformers import SentenceTransformer
model = SentenceTransformer(&...
Best practices
0
votes
4
replies
113
views
Ways to loop through list of dictionaries containing a known pair of keys
I'm pretty new to Python and am trying to understand the different ways of achieving things.
I have an list of dictionaries with key value pairs:
a = [ { "Key": "K1", "Value&...
Best practices
0
votes
5
replies
100
views
Developer python environments including DLLs
I am developing a python package for reusable complex task automation against a software's python interface. To develop a clean interface, I want to develop in a distinct environment.
I have tried ...
Best practices
2
votes
3
replies
115
views
Advice for setting up the environment of a python project
I am a beginner and wanted to understand a best practices for a python project. Any advice would be helpful!
- I'm using the miniconda distribution for python instead of the homebrew one. So for each ...
1
vote
1
answer
58
views
Row filtering a QTableWidget in PyQt5
Originally, I had a simple filter function that took the text from a QLineEdit and matched it with the text from all cells in a QTableWidget like this:
class MainWindow(QMainWindow):
def __init__(...
3
votes
1
answer
109
views
Teams OAuthPrompt Inconsistent Behavior – Sometimes Works Without Magic Code, Sometimes Returns CancelledByUser and Requires Manual Code
I am facing inconsistent behavior with OAuth login in my Microsoft Teams bot (Python, OAuthPrompt).
Working Case
User clicks Sign In.
User enters email and password.
Login completes successfully.
...
0
votes
0
answers
28
views
Difference in Measuring Latency of (torch.)Multiprocessing.Queue
I'm writing a program that requires transferring GPU tensors across processes in a pipeline manner.
I knew that using torch.Multiprocessing would automatically get the CudaIpcMemHandle for me and send ...
Advice
6
votes
4
replies
173
views
I am learning the Python programming language
I am a complete beginner in programming and need advice on where to start learning the Python programming language.
1. Where to find information
2. What to pay attention to
Starting from scratch so ...
0
votes
1
answer
75
views
CompositeVideoClip Error - Python 3.14 - moviepy 2.2.1
I am trying to run a simple moviepy (version 2.2.1) example where I'm cutting a video into clips to edit the clips individually, but running into issues by simply cutting into clips and rejoining them:...
0
votes
0
answers
56
views
Member permissions must be used when using member as author - LinkedIn API
I'm trying to get the posts in from my personal LinkedIn account and I generated a token using linkedin developer token tools after I created an app. the app has Community Management API product ...
Best practices
0
votes
0
replies
83
views
APScheduler job still executes after pause_job() and creates duplicate resume jobs
I am using APScheduler (BackgroundScheduler) to run a job every 10 seconds.
Additionally, I pause the job every 2 minutes and resume it after some time.
However, I am facing two issues:
1. Job ...
-2
votes
1
answer
110
views
Python uses pyxtxt.xtxt (filename) with special characters from the Brazilian Portuguese language (ç, á, é, à, í)
I need to use pyxtxt.xtxt (filename) to read the contents of some files, and everything works fine when the filename doesn't contain special characters from the Brazilian Portuguese language (ç, á, é, ...
0
votes
3
answers
178
views
Strange Pylance error on simple Appium-Python-Client setup
I have a basic project with python 3.13.2 and Appium-Python-Client 5.2.6
python analysis typeCheckingMode is set to standard in vscode config
I created a single file with this code :
from appium ...
0
votes
0
answers
28
views
Python virtualenv with sync
I use python with virtual environments on manjaro linux.
I install the package python-virtualenvwrapper, then I added
export WORKON_HOME=$HOME/.virtualenvs
export VIRTUALENVWRAPPER_PYTHON=/usr/bin/...
Advice
2
votes
3
replies
70
views
Why can't I use Iterable as a type for overloading a singledispatchmethod?
Why can't I use the typing.Iterable class to overload a singledispatch method? It works for other generi classes such as numbers.Number.
For instance the following minimal code will raise a TypeError ...
1
vote
0
answers
37
views
BeautifulSoup reorders HTML tag attributes alphabetically - how to preserve original order? [duplicate]
When I read an HTML file with BeautifulSoup and save it, the attributes inside tags get reordered alphabetically. For example:
<!-- Original -->
<meta http-equiv=Content-Type content="...