2,209,248 questions
0
votes
0
answers
100
views
SSLCertVerificationError when fetching OpenML datasets in conda environment on Ubuntu
I’m on Ubuntu using a conda environment (ML(Python 3.12.9)), and I get a SSL certificate verification error when trying to load a dataset from OpenML with sklearn.datasets.fetch_openml. I already ...
Advice
0
votes
7
replies
125
views
How can this code make me look better as a programmer
#!/usr/bin/python
import sys,os,math,random,time, json # import everything badly
GlobalVar = 0
globalList = [1,2,3,4,5,6,7,8,9,0]
class myclass(object):
def __init__(Self,Name="bob",age=...
0
votes
1
answer
56
views
SQLAlchemy and partitioning table [closed]
I have tables which are already in Postgres and partitioned. How can I write a query with partioned birth_year
stmt = select(UserOrm)
session.execute(stmt)`
2
votes
1
answer
80
views
Freeing memory to OS after heavy function without forcing GC
I have a Python function that consumes a large amount of memory. When the function finishes, I want to release the memory and return the freed pages to the operating system by calling malloc_trim(0).
...
-1
votes
1
answer
59
views
future module in debian
I want to use this app. As it is mentioned in the README.md it needs the future module of python. I have debian sid and python3-future is removed from the repos of apt. When I install it via its setup....
Advice
1
vote
0
replies
43
views
Billing during idle time
Service details
Scaling: Auto (Min: 0, Max: 1)
Billing: Request-based
the chrome browser was able to run during the idle time of the instance
app = Flask(__name__)
driver = None
@app.route("/&...
2
votes
2
answers
75
views
Combined Pydantic settings class from multiple settings classes with individual environment files
Let's say I have 2 simple BaseSettings classes that, each, load values from their individual environment files. Let's also say that there is a combined settings class that is based on the first 2 ...
2
votes
1
answer
76
views
Multiple variable/correlation analysis using Python
I have a machine with up to 58 indipendent input variables and one response variable. If I create 2D-histogram plots of all combinations of 2 input variables and the response variable, I get plots ...
-2
votes
0
answers
55
views
How to remove todo checkmark from Spyder?
Ever since I wrote this line of code there has been a todo list checkmark next to it and I have no idea why or how to get rid of it.
I have tried clicking it, right clicking it, going to Source -> ...
1
vote
0
answers
56
views
Python Customtkinter: Getting real widget size
I seem to be always getting 120 for both height and width, I don't know why it refuses to give me the real value for the width so I can make the maintain the height in a 16:9 ratio
# Monitor frame
...
0
votes
0
answers
47
views
What causes extra subprocesses to be created by Python multiprocessing? [closed]
I've built a command-line app using the Python multiprocessing module, specifically a small suite of long-lived processes explicitly created via Process (with the spawn context, on Linux) ...
Advice
1
vote
4
replies
69
views
Add an instance to a virtual subclass?
With abstract subclasses on can use register to add other classes as a "virtual" subclass, what would be a way to do that for a single instance based on it fullfilling some criteria?
The &...
2
votes
1
answer
60
views
subprocess.Popen wait doesn't seem to wait for Google Chrome on macOS
p = subprocess.Popen([
"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome",
f"--remote-debugging-port={SOME_PORT_NUM}",
"--no-...
0
votes
0
answers
36
views
Attribute error: 'open3d.cpu.pybind.geometry.PointCloud' object attribute 'points' is read-only [closed]
Error appearing at pcd_las_o3d.points unable to assign extracted points to variable points
points= np.vstack([las.x,las.y,las.z]).T
colorsd= np.vstack([las.x,las.y,las.z]).T/65535
pcd_las_o3d.points = ...
1
vote
0
answers
55
views
How to enable endpoints with optional authentication using the Litestar framework
I am trying to define endpoints in a Litestar application in which authentication is optional, but am failing to understand how this can be accomplished with the JWTAuth security backend.
With an ...
1
vote
0
answers
38
views
Segments too short for OpenSmile feature processing
I am currently working on creating a time series of feature vectors from video input with consistent capture at 30 fps, ignoring the fps of the input video. I have decided to use PyAV to split the ...
3
votes
1
answer
97
views
Extracting decimal and negative numbers from PDF, where decimals look like exponents in the PDF
I am processing a set of PDF files using Python.
From each PDF I need to extract several monetary amounts and then write them to an Excel file.
The problem is that in the PDF the decimals are written ...
Best practices
0
votes
3
replies
63
views
Are there any advantages to having mypy check only your entrypoints in your Python program versus every single file?
I'm working with a large, existing Python codebase. Recently someone noticed that one of the files in the testsuite wasn't being type checked by mypy and so suggested to run python -m mypy . rather ...
0
votes
0
answers
27
views
How to get Test Suite ID and Test Plan ID in the same dataframe as the Test Case ID? [closed]
Need to build a Python script for getting test_run_id, test_result_id, test_case_id, test_suite_id and test_plan_id from Azure DevOps. Only get NULL values for suite and plan. Any recommendations?
Best practices
1
vote
4
replies
124
views
Open Vim with text in it, without saving the file
I want to write a script which ends by calling my text editor (vim) on a specific file path. The file doesn't yet exist, and I want the editor window to already have some contents in it. In particular,...
1
vote
1
answer
40
views
new ciscoconfparse2 does not have the gobal delete_lines anymore. alternative?
parse.delete_lines('mls qos trust dscp')
global in all objects
doesn't work:
'CiscoConfParse' object has no attribute 'delete_lines'
1
vote
0
answers
51
views
ModuleNotFoundError: No module named 'webdrivermanager' with Spyder
Question: Why do I get the error I get, although to me it seems that the webdriver is in PATH?
Problem description and context:
I am trying to do some coding that requires using the webdriver manager ...
Advice
0
votes
1
replies
34
views
Communicate PLC FX1N with Python
Can I communicate PLC FX1N with Python. I have follow tutorial on youtube for FX3U using RS-485 and RS-422 but when i transmit data from Python to PLC , it's always fail, is it because this method ...
0
votes
1
answer
54
views
Monitor `asyncio.create_subprocess_exec` pipes for errors
I am trying to pipe multiple Linux commands and abort if there is an error. With Popen the communicate() method waits for all commands to finish. This is why I am trying asyncio now.
I have the ...
2
votes
0
answers
46
views
PywinAuto API - child_window - returning multiple elements
Here is my code which is throwing me an error
I am trying to open a Group Policy Editor and select setting under Personalization.
I have obtained the sample code from this question
GUI Automation of ...
-1
votes
1
answer
54
views
DocuSign Sandbox: “ENVELOPE_ALLOWANCE_EXCEEDED” After 114 Envelopes and Trial Account Cannot Create Integration Key [closed]
I am working with a DocuSign sandbox (developer) environment to integrate embedded signing and webhook functionality into a Django REST Framework application. Initially, I was able to send envelopes ...
-3
votes
0
answers
70
views
Python - updating CSV file [closed]
I am making a To-do app and the priority,status,time left to finish and the name is saved in a CSV file.When the status is updated the the CSV file status should also be updated this is the code when ...
Best practices
0
votes
3
replies
51
views
How to make a Pydantic field conditionally required based on another field?
I'm building a Pydantic model where a field's requirement depends on the value of another field.
Specifically, I want the cpf field to be required only if the country field is set to "BR". ...
1
vote
3
answers
73
views
How can I center the Input fields? The method align_horizontal does nothing
Python Textual does not center the input fields. I centered the input fields, but they are displayed left justified.
How do I center the input fields?
from textual.app import App, ComposeResult
from ...
3
votes
1
answer
66
views
How to pass variables to a template HTML with Flask
i'm currently learning Flask templates, but i can't undestand how to pass a variable to it. Example of my Python code:
from flask import Flask
app = Flask(__name__)
@app.route('/')
def home():
...
1
vote
1
answer
86
views
PicklingError: Could not serialize object: RecursionError in pyspark code in Jupyter Notebook
I am very new in Spark (specifically, have just started with learning), and I have encountered a recursion error in a very simple code.
Background:
Spark Version 3.5.7
Java Version 11.0.29 (Eclipse ...
5
votes
2
answers
106
views
How to resample timeseries with origin aligned to start of year
Consider the following pandas Series with a DatatimeIndex of daily values (using day-of-year as an example):
import pandas as pd
dti = pd.date_range("2017-11-02", "2019-05-21", ...
Advice
0
votes
2
replies
114
views
Analysis of a tapering function
On Window function - Wikipedia tapering functions are plotted using two different styles. One shows curve (samples) and the other Fourier transform (bins).
I've prepared two tapering functions based ...
1
vote
0
answers
71
views
text moves vertically when exiting text boxes in Tkinter form
I'm trying to create a short form in tkinter python but am new to the language. Whenever I click off of the text box the text underneath moves down vertically and the error message displayed has a ...
1
vote
1
answer
51
views
How do I get around a typing issue for execute_workflow in PyCharm
I have a test that has code that executes a workflow which PyCharm marks as incorrect (pyright doesn't complain)
result = await workflow_client.execute_workflow(
SayHelloWorkflow.run,
req,
id=&...
Best practices
0
votes
1
replies
55
views
How to pass around scipy fit results and corresponding functions
I am looking for advice on how to best pass around the fit results from a (Python) script to another script.
Currently, I am exporting the best-fit parameters and function names into a YAML file. I ...
0
votes
0
answers
26
views
Metashape Python lat/lon to local coordinate center problem [closed]
I am having problems with the Metashape Python API:
I am drawing a polygon with Google Maps API and give these coordinates to Metashape. Metashape takes the polygon without problem, but the center in ...
0
votes
0
answers
20
views
tnmaccess api not returning results
The tnmaccess api is not working for me. No matter what bounding box I use it always returns 0 results. Is it broken, or am I doing something wrong?
import requests
API = "https://tnmaccess....
0
votes
0
answers
25
views
Is there a way to stream ollama chat into a Marimo ui?
I am wondering if there is the possibility of using a stream for Marino notebooks in the ui.chat, something along the lines of:
from ollama import chat
model = 'llama3.2'
def simple_stream(mess, ...
Advice
0
votes
2
replies
47
views
How to port tox legacy-ini with factors to native toml?
I have a project with tox configuration for testing, with different versions of Python and Django. With the move from tox 3 to tox 4, I included the configuration as a legacy ini in my pyproject.toml ,...
0
votes
1
answer
46
views
Tkinter image will not change [duplicate]
import tkinter as tk
from tkinter import ttk
root = tk.Tk()
def change():
img2 = tk.PhotoImage(file = "img2.png")
label.configure(image = img2)
img1 = tk.PhotoImage(file = "...
0
votes
3
answers
152
views
How to automatically convert from Python 2 to 3 now that 2to3 is removed [closed]
I'm playing around with an old project that uses Scons for its build system. Unfortunately that was written with Python 2, which I'm trying to avoid having to install.
The script 2to3 has been removed ...
Advice
0
votes
4
replies
52
views
How to write bytes as a b' string to a file?
from PIL import Image
img = Image.open('some/file.png')
img = img.convert(mode='1')
imgbytes = img.tobytes()
with open('filepath', 'w') as file_out:
file_out.write(imgbytes)
I would like to write the ...
-1
votes
0
answers
76
views
get the data from the server with fetch API [closed]
i get the data from the server with fetch API it contains html, when i click on load more posts button it should load the html at the bottom of the page we got from the server, but it also loads the ...
0
votes
0
answers
87
views
I get a following import error: ImportError: libssl.so.3: cannot open shared object file: No such file or directory [closed]
I am using Python 3.8.10 and trying to import mariadb (pip install mariadb==1.0.11).
I tried installing Ubuntu packages (Ubuntu 20.04.6 LTS), but it does seem to contain the following so.
0
votes
0
answers
77
views
URL Targeted web crawler [closed]
I have a bit of code I am trying to build to take a specific tumblr page and then iteratively scan by post # sequentially and check to see if a page exists. If it does it will print that full URL to ...
2
votes
2
answers
127
views
Looking for proportion of prime numbers in a list, error in code
I'm trying to solve this Project Euler task which is to find the point at which the proportion of primes in a list drops below a certain percentage (the diagonals in this spiral of numbers below).
I ...
Advice
0
votes
0
replies
44
views
How is Datadog able to collect trace data without any modification of application code?
when running a flask app just have to prepend ddtrace-run to python app.py
Just by doing this datadog can collect informtion like api paths, latency, response status, etc. I searched online about it ...
0
votes
1
answer
58
views
Error: "'utf-8' codec can't decode byte 0xd6 in position 4: invalid continuation byte" when trying to open .wav file
I am receiving my ".wav" file in a django view as an "InMemoryUploadedFile" then converting it to bytes:
views.py
import functions.bytes_to_wav_wave
if voice_value:
...
0
votes
1
answer
68
views
subprocess cannot use stdout with CREATE_NEW_CONSOLE on windows
test.bat:
@echo off
for /L %%i in (40, -1, 10) do (
echo working %%i test1
ping localhost -n 2 > nul
)
echo Done!
main.py:
import subprocess
startupinfo = subprocess.STARTUPINFO()
startupinfo....