103 questions from the last 7 days
-3
votes
1
answer
168
views
How does attribute access (.) actually work internally?
When I write obj.attribute in Python, what exactly is the sequence of operations and lookups that Python performs to resolve this attribute?
I want to know when and how methods like __getattribute__ ...
2
votes
3
answers
85
views
Python packages installation - pandas & nympy
I have read close to all posts about this topic now but I can get it working, so sorry if you find this similar to other questions, but I can't just solve it based on existing posts.
I find it very ...
Best practices
0
votes
7
replies
94
views
Python nested comprehension: is possible return an attribute of function?
Mainly pseudocode: return function(item) if function(item) != item[index]
(I'm using Flask with session)
With this function above,
updated, (accelerated reworking following Tim Roberts suggestion):
...
2
votes
2
answers
204
views
Solving a cubic polynomial using numpy
I intend to design the foundation of an elevated water tank, consisting of a raft with the shape shown in the image below. To do so, I need to determine the raft diameter Dr by solving the following ...
3
votes
1
answer
104
views
How do I resolve this circular import?
Implementing a virtual file system I encounter a circular import problem.
common.py:
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from .directory import Directory
from .archive import ...
1
vote
1
answer
77
views
Source path does not exist during folder migration from one Windows PC to another using Python script
I wish to migrate a folder tree structure from one Windows PC to another by running a python script on the destination PC. Here is the code I am using:
import shutil
import os
import sys
import ...
Advice
0
votes
6
replies
123
views
Where can I find a quick guide to Python?
I need a Python guide that has everything I need, preferably in text mode. You could say it was like a cheat sheet, the main thing is that it was clear and brief. Ideally, it should include key syntax,...
1
vote
1
answer
83
views
Jupyter Lite outputs a blank file when I use plt.savefig() [closed]
I'm writing a Python code that's supposed to create a graph and export it as a vector PDF file. I'm using Jupyter Lite at jupyter.org.
I've successfully created the graph, but when I try to export it ...
Advice
1
vote
6
replies
100
views
How do I get specific values from specific keys in dictionary?
I have made a dictionary and a list of dictionaries but I am not sure how to get specific data from the different forms. I tried using '.startswith('7') but always gives me an error. I want to get the ...
Advice
1
vote
4
replies
124
views
Pygame or Love2d for game development?
I have been looking at frameworks for game development and I have found that pygame (a python game development libary) and love2d (a lua game development libary) seem the eisiest to learn. I also know ...
4
votes
2
answers
79
views
How to fix "requests.exceptions.ConnectionError" when using requests library python?
I have been trying to make a scraper that downloads comics from Poorly Drawn Lines but I keep on getting a requests.exceptions.ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end ...
2
votes
1
answer
101
views
Debugging Jupyter Notebook in VS Code
I tried to debug a notebook in VS Code but I can't. When I set a breakpoint and run debug cell or press F5, I am getting this error
/usr/bin/env /home/user/anaconda3/envs/myenv/bin/python /home/user/....
4
votes
1
answer
72
views
python 3.14 shared mutex lock
I'm trying to create a shared mutex in python (ala C++ shared_mutex) so I can have multiple threads read a variable while one thread can acquire an exclusive lock (blocking all readers) while it ...
4
votes
0
answers
132
views
How to intercept a markdown file and display as HTML?
As part of my application, I want to use QWebEngineView to display the contents of a local markdown file as an HTML page. Local files will end in '.md'.
In Qt version 6.9 I wrote the following code to ...
1
vote
1
answer
85
views
How to automate versioning via CI in a Python project? [closed]
I have a Python project using pyproject.toml and I want to figure out the best method to automate incrementing the version. The requirements are:
Each time the package is modified (e.g.: src/**, ...