2,263 questions
2
votes
1
answer
90
views
Can't use lock around gather in Python asyncio
For some reason, this code doesn't work on Ubuntu 20, Python 3.8.10, unless the .gather line is commented out.
It works on Ubuntu 24, Python 3.12.3 and Windows 11, Python 3.13.9.
It doesn't work on ...
0
votes
0
answers
280
views
Problem launching chromium with remote-debugging-pipe from python
I was trying to launch chromium browser using remote-debugging-pipe in python,
but there is a problem everytime I tried to do so,
I am using this code,
I got help from gemini and chatgpt but they don'...
-1
votes
0
answers
256
views
Starlette/FastAPI Default Exception Handler Overriding Error [duplicate]
I'm trying to override the default exception handler in a FastAPI application so I can log any exceptions that happen. The problem that I run into is that my handler seems to run as it logs what I ...
-1
votes
2
answers
60
views
How do I change a property in a Python function to be optional?
**I want to make a module. The modules can easy to use Python. But I'm in trouble.
The code is:
class EasyPy:
def easy_print(self, condition, implementation):
if implementation is None:
...
0
votes
0
answers
74
views
Building wheel for mysqlclient (pyproject.toml) did not run successfully
I'm trying to install mysqldb on python3.8 (Windows 11 24H2).
I initially had issues with VSC++14 but I managed to solve them.
pip install -U flask_mysqldb
error: subprocess-exited-with-error
...
0
votes
0
answers
59
views
python 3.8 package installed but pkg_resources not able to found
Using old python version 3.8.6.
I created virtual environment in /var/virtualenvs/myvenv and installed mypkg.bouncer.client but when we import that, it gives below error.
Traceback (most recent call ...
0
votes
2
answers
76
views
Mock a module that export a class in python
We're working on a message-based communication mechanism. We have several classes that manage incoming messages and send outgoing messages at a high level (Commands, Queries, and Events).
Underneath, ...
2
votes
2
answers
63
views
Array slicing inside `jax.lax.while_loop yields error` "array boolean indices must be concrete"
Please consider the following toy example, which mimics what I'm trying to achieve in my real-world application:
import flax
import jax
def op(x):
return x - 1
@flax.struct.dataclass
class ...
-2
votes
1
answer
229
views
How to set up same SSLContext in Python 3.8 through 3.13? [closed]
My code so far:
def _ssl_context(self, ca: str | None) -> ssl.SSLContext:
# NOTE: ssl.create_default_context() doesn't allow setting the context.protocol in a way
# that's the ...
0
votes
1
answer
98
views
Python Squish wrapper that reports the original call location
Just some background, so this doesn't end up being an XY Problem:
The Squish library has some basic methods to do tests, test.verify, test.compare, etc.
Because the screenshot functionality is not ...
-2
votes
1
answer
349
views
Object is not subscriptable in Scrapy Fake User Agent
I got this error:
from fake_useragent import UserAgent
File "D:\Kerja\HIT\Python Projects\Ongoing Projects\Andrew Mancilla\mancilla-env\lib\site-packages\fake_useragent\__init__.py", ...
0
votes
0
answers
46
views
W7. Python has stopped working When running bots on discord
The problem happened right after I executed the command on the discord server.
This problem has happened many times on my win7 despite trying and fixing it in many ways such as upgrading pip, checking ...
0
votes
1
answer
78
views
Why I am unable to create connection with MySQL using python
The program terminates automatically without throwin any error or output
The port and connector working fine and details are given below
C:\Users\jsr>pip list
Package Version
--------...
0
votes
0
answers
81
views
How to set server name in kubespawner in jupyterhub notebook in GKE
import json
import os
from kubespawner import KubeSpawner
class CustomKubeSpawner(KubeSpawner):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
def load_config(self):
...
-1
votes
1
answer
50
views
ModuleNotFoundError when referencing folder in Python [duplicate]
I have a Python3 project arranged as follows:
C:\automation\framework\constants.py
C:\automation\tests\unit-tests\test_myunittest.py
In my unit test, I'm trying to call methods in framework folder, ...