398 questions
2
votes
1
answer
69
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 ...
2
votes
1
answer
108
views
Type checker highlights 'Unexpected argument' for dynamically generated function
I'm trying to create a function dynamically. Here is an example:
import ast
import textwrap
from typing import Any, Callable, List, Union
def create_function(
func_name: str,
arg_types: List[...
4
votes
1
answer
94
views
TaskGroup in Python 3.11 freezes if one task raises an exception - is it a known bug?
There are two tasks in a task group. One of them raises, the other one should be cancelled. This works fine in Python 3.12+, but freezes in Python 3.11. Older versions did not support task groups.
Is ...
0
votes
0
answers
124
views
Using OpenStreetMap on Superset
I am trying to setup Apache-Superset, so that it uses OpenStreetMap instead of MapBox.
I am currently using Superset in their local Python Version (not the Docker one), I have modified the config.py ...
0
votes
0
answers
186
views
How to install Miniconda or switch Python version (3.12 → 3.11) in Modal Notebooks?
I’m trying to run Chatterbox TTS on Modal Notebooks.
Modal by default uses Python 3.12, but chatterbox requires dependencies (like numpy==1.25.2) that fail to build because distutils was removed in ...
1
vote
1
answer
939
views
Unable to uninstall Python 3.11 on Windows 11 – Error when uninstalling from Settings/Control Panel. Gets 'D:\Config.Msi\e9e4050.rbf'. Error: 5
I was trying to uninstall Python 3.11 from my Windows 11 Pro 24H2 laptop.
When I tried from:
Windows Settings → Apps
or
Control Panel → Programs and Features the uninstallation failed multiple times.
...
0
votes
0
answers
43
views
C Function Stalls in Docker but Works Fine on EC2
Technical Details
The stall occurs in a C function from a shared library that performs numerical calculations for Rayleigh wave phase velocities
Using py-spy, I traced the issue to this specific ...
0
votes
0
answers
36
views
Waitress does not run when trying to execute explicitly with a specific Python version
We have to manage several Python versions for several requirements and we have three different Python versions: 3.8, 3.11 and 3.12. When executing the Waitress server with a specific version, it does ...
-1
votes
1
answer
184
views
Azure Function App -Calling a function in another file from function_app.py
Very simply!
I have a function app - function_app.py, trigger.py and init.py in the root
Its my first Azure Function App.
if i run the two files separately, function_app.py, trigger.py, they both ...
1
vote
1
answer
91
views
Why can I not get Python 3.11.0 to report the expected machine architecture after installing from python.org
I have downloaded and installed the macOS 64-bit universal2 installer for Python 3.11.0 - Oct. 24, 2022 from macOS 64-bit universal installer on my Apple M4 Silicon macBook Pro.
When I open the ...
1
vote
1
answer
228
views
Why does pathlib.Path.glob function in Python3.13 return map object instead of a generator?
I was playing around with Path objects and found an interesting behaviour. When testing with python3.11, Path.glob returns a generator object.
>>> from pathlib import Path
>>>
>&...
0
votes
1
answer
460
views
Django WSGI and ASGI
How can I run the ASGI and WSGI protocols separately in my Django project?
This is my project structure.
.
├── chat # <== my app name
│ ├── apps.py
│ ├── consumers.py
│ ├── __init__.py
│ ├─...
3
votes
1
answer
416
views
What is the correct way to please the typechecker for a '(bytes | str) -> str' function?
I have the following code:
def from_utf8(string: bytes | str) -> str:
if isinstance(string, bytes):
return string.decode("utf-8")
else:
return string # <- type ...
1
vote
1
answer
59
views
Performance and Memory duplication when using multiprocessing with a multiple arguments function in Python?
I am having difficulties understanding logic of optimizing multip-rocessing in Python 3.11.
Context:
I am running on Ubuntu 22.04, x86 12 cores / 32 threads, 128 GB memory
Concerns:
(Please refer to ...
0
votes
0
answers
29
views
Python Postgres pull as byte object vs str
I'm doing a basic Python Flask application with a Postgres database using psycopg2. I'm having trouble setting up the user registration password hash as it appears I'm working with a string vs byte ...
0
votes
0
answers
109
views
Sudden Picamera2 import failure
I have a script that utilizes picamera on a raspberry pi 5. It's been working great for months, the all of sudden it started throwing errors. Here is the start of the script
# Import libraries
import ...
0
votes
0
answers
40
views
Accidentally created a infinite loop while trying Match Case
I did an oopsie and made an infinite loop at the match case in the end:
import pyautogui
import cv2
import numpy as np
import time
def find_image(image_path, confidence=0.8):
screenshot = ...
0
votes
0
answers
89
views
Issues running DeepFace python library in Touchdesigner
Hi i've got some issues using DeepFace python library in touchdesigner, i've installed python 3.11 and other packages realted like pandas,tensorflow,numpy to make DeepFace work properly on my MacOs ...
0
votes
1
answer
40
views
getting SSLError in Python3.11.4
import requests
from requests.auth import HTTPBasicAuth
username = ""
password = ""
response = requests.get(url, headers=headers, auth=HTTPBasicAuth(username, passwrd))
Getting ...
1
vote
2
answers
143
views
ModuleNotFoundError: No module named '_sqlite3' after installing spyder-kernels 3 for Spyder 6.0 IPython console
I am trying to use Spyder 6 IDE on Ubuntu 24.04. After installation of Spyder 6, I changed the default python interpreter to my virtual environment running Python 3.11 and installed spyder-kernels==3....
0
votes
0
answers
43
views
Extract specific exception from ExceptionGroup tree
ExceptionGroups in Python contains tuple of unrelated exceptions. Some of these exceptions can be also exception groups. So the specific exception (not the group one) can be nested in several ...
0
votes
1
answer
258
views
AWS Lambda Execution Failing with AWS Common Runtime Error [duplicate]
I'm attempting to deploy a lambda function using python and the boto3 dependencies to interact with a CloudFront key store. I'm getting an error I don't quite understand suggesting I don't have ...
0
votes
1
answer
169
views
Netmiko send_command() not capturing cli timestamp on Juniper devices
Netmiko version = 4.4.0
Python version = 3.11
I'm using Netmiko to log into a Juniper MX router and I want to get the timestamp of the command along with command output.
I log into the Juniper router ...
2
votes
1
answer
68
views
Python Tkinter Notebook gets resized when I pack a ttk.Treeview on the second tab
I am trying to write a program to time sailing races, and to simplify adding the boats to a race by selecting from a list.
I have used a Treeview linked to a tk.StringVar() to filter the boats by ...
2
votes
1
answer
155
views
Is there a reason that some keys and values will not load in TOML? (Python config import)
I've set up my flask app to read my config file...
app.config.from_file("../CONFIGS/config.py", lambda f: tomllib.load(f.buffer))
f.write(str(app.config))
when I go to see the output some ...
1
vote
1
answer
227
views
Correctly tear down process when using pytest with multiprocessing
I am working on a package that includes a server with the corresponding client.
I was thinking that I could save a lot of effort mocking all the interactions and just write some test cases that test ...
0
votes
0
answers
76
views
Why "PyRun_SimpleString("from PIL import Image")" does not work in debug mode?
I'm writing a c++ program that use Python library EasyOCR to read some text. I wrote such code:
Py_Initialize();
PyRun_SimpleString("import sys");
PyRun_SimpleString("import easyocr&...
-1
votes
2
answers
202
views
Django ModelDiffMixin: Maximum recursion depth exceeded
I am getting a weird error after upgrading the Django version from 4.0 to 4.2.15.
The error being encountered is:
RecursionError: maximum recursion depth exceeded while calling a Python object.
The ...
2
votes
1
answer
168
views
Async server and client scripts stopped working after upgrading to Python3.12
So I have two scripts that use asyncio's servers' for communication, the script's work by the server opening an asyncio server and listening for connections, the client script connecting to that ...
1
vote
1
answer
2k
views
Libexpat Vulnerabilities exists in python:3.11-slim Docker Image
There are three vulnerabilities: CVE-2024-45490, CVE-2024-45491 and CVE-2024-45492).
It looks, these vulnerabilities get fixed as part of https://github.com/python/cpython/issues/123678
But when I ...
-1
votes
2
answers
99
views
Display error on a Remote RaspberryPi connected via SSH
I am running a Tkinter window on a remote Raspberry Pi with a display.
I want to see the Tkinter GUI on the display of RPi. I am connected to the RPI via Putty(SSH, from a Windows PC). RPi has a 64-...
0
votes
2
answers
139
views
Python 3.11 os can't read log files
I have a working logger module built on DBR 10.4/python 3.8 platform that creates the log and periodically export to a blob storage. Recently we've moved to DBR 15.2/python 3.11, and now the logger ...
1
vote
1
answer
82
views
Python App Runs Fine in Python VENV, Crashes as Flatpak
I'm trying to build a Flatpak of the Amulet Minecraft Map Editor, which runs fine when run directly through Python 3.11.9 (in a VENV) on Linux, Windows and MacOS, but on Linux, the Flatpak version ...
1
vote
1
answer
359
views
ImportError: cannot import name 'ClickHouseQuery' from 'pypika.dialects' while using chroma client
I'm trying to import and use chromadb to play as a vector store for my RAG application. But it is giving ImportError as it is trying to import pypika packages in the backend which I cannot control ...
-2
votes
1
answer
517
views
Webscraping with python | How to pass a hCaptcha
I'm trying to automate a task that i enter in a public website, from the brazilian government, and collect some public data from some companies. But when i am entering with selenium in the website i ...
0
votes
0
answers
397
views
How can I fix a 'socket.gaierror: [Errno 11001] getaddrinfo failed' when trying to use an SMTPHandler in Python 'logging'?
I am currently trying to log using the SMTPHandler class from Python's logging module. The logger is instantiated just fine, but fails when calling _socket.getaddrinfo even though it is being passed ...
0
votes
1
answer
266
views
How to capture pytest durations statistics within the test report
I am using the durations options in the pytest commandline to extract information of the top 5 slowest tests. Below is the information that is printed in the console at the end of tests. The test ...
1
vote
0
answers
207
views
log files are vanishing from the working directory when trying to read and export them in Python 3.11
I am defining a logger and periodically exporting the content to a blob. I've been using it for some time with DBR 10.4/python 3.8 without any issue. However we've moved to DBR 15.2/python 3.11, and ...
0
votes
0
answers
42
views
Using Python to obtain monthly general ledger for AWS China region
Use the following Python code to obtain the monthly total bill for AWS China. After the code is executed, some information is obtained. However, when the obtained data is compared with the final bill ...
3
votes
1
answer
11k
views
Can't fix "ModuleNotFoundError: No module named 'setuptools.extern.six'"
I've been trying to test out a colony counter code I found on GitHub that could be of use. However, the windows that generates when i run the code aren't the same as the ones that are demonstrated in ...
0
votes
1
answer
31
views
Create limited Tables from ForeignKey dependency map in SQLAlchemy ORM
I have the following code:
from sqlalchemy import (create_engine, Column, String,
Integer, Float, ForeignKeyConstraint)
from sqlalchemy.orm import (DeclarativeBase, relationship)
...
0
votes
0
answers
1k
views
Getting error importing numpy dependency when importing pandas in Python 3.11
I recently had my work computer changed due to IT policy and had to reinstall my Python environment. My work computer is Policy controlled so I cannot install Python from the official Python.org ...
2
votes
0
answers
325
views
AWS AppRunner with Python 3.11.x failing health check when same config with Python 3.8.16 passes
I've been trying to deploy a django web app on AWS AppRunner. I followed an AWS tutorial here which works to deploy an app running on python 3.8.16. I tried to follow the same procedure but use ...
3
votes
0
answers
96
views
Activating virtual environment makes python disappear?
Screenshot of Visual Studio Code terminal
As shown in the screenshot, python works just fine in Powershell.
I then activate the virtual environment at E:\DrewFTCAPI\ftcapivenv and python is gone. Not ...
0
votes
2
answers
307
views
StrEnums and type narrowing (mypy)
I am fighting with type narrowing of StrEnums
To summarize my issue I have some abstract base class
from abc import ABC, abstractmethod
from enum import StrEnum
class Animal(ABC):
@staticmethod
...
0
votes
0
answers
236
views
"Error when deserializing class 'SpatialDropout1D' using config:
Error Response is this,
"message": "Error when deserializing class 'SpatialDropout1D' using config={'name': 'spatial_dropout1d', 'trainable': True, 'dtype': 'float32', 'rate': 0.4, '...
0
votes
0
answers
160
views
Different behaviour between win 10 and win 11 of a python script
The following code works differetly between two PC with identical PY version 3.11.9, identical libraries installed and identical source folder files.
The aim is to open every single excel file in a ...
2
votes
2
answers
332
views
Return a column with more than 16384 bytes
I am using a sybase ase 15 database. And I have a column of type image (this column stores SQL querys) so I have to convert it to varchar to return the text. The problem is that I can't return more ...
-1
votes
1
answer
65
views
Mute command does not check for member permissions
I have been programming a Discord bot, and I added a mute command to it that works perfectly fine. However, anyone that has access to the command can mute anyone they please, even people with the ...
-1
votes
1
answer
73
views
My Python program outputs vertically unexpectedly
I'm learning the Python programming language with the book "Self-taught Programmer" and just really starting out. no idea or knowledge previously so I'm currently stuck on working with ...