Questions tagged [python-3.11]

Python 3.11 is the newest release of the Python language. Please use the [python] tag for general Python related questions.

Python is an interpreted, high-level and general-purpose programming language. Python's design philosophy emphasizes code readability with its notable use of significant indentation.

References

308 questions
2
votes
1 answer

Forbid enum entry as a value for function argument with python typing

I have an enum of commands, where all of them have some value except SERVER_CONFIRMATION: class ServerCommand(StrEnum): SERVER_CONFIRMATION = "" SERVER_MOVE = "102 MOVE" SERVER_TURN_LEFT = "103 TURN LEFT" SERVER_TURN_RIGHT = "104…
2
votes
0 answers

Descriptor protocol used in binding class method results in error in Python 3.11.2

Full disclosure, I'm fairly new to Python, which is mostly a non-issue when it comes to day-to-day syntax; however, I have an issue that stems from using the descriptor protocol to bind a method from one class to another class while binding/locking…
Erik Eppel
  • 21
  • 1
2
votes
1 answer

I'm getting an error with Uncompyle6 and Decompyle3 after getting the bytecode from pyinstxtractor

I got this error when I tried Uncompyle6 uncompyle6 main.pyc : Traceback (most recent call last): File "", line 198, in _run_module_as_main File "", line 88, in _run_code File…
lunix
  • 151
  • 1
  • 14
2
votes
0 answers

Deepcopy somehow changes set.difference behaviour

Lately I noticed that copy.deepcopy changes the behavior of set.difference. I have a class called Foo that implements hash returning the id attr. I create two instances of this class each with a different id, add them to an array, and make a…
2
votes
1 answer

ttk Entry widget font being overwritten by theme

Does anyone know why the ttk.Entry widget font is being overwritten when creating the widget outside of a function called by a Button but it retains the font correctly if you create the widget using a ttk.Button? import tkinter as tk from tkinter…
Michael
  • 23
  • 2
2
votes
1 answer

Type Hint `Callable[[int, ...], None]` using `ParamSpec`?

Similar to Python type hint Callable with one known positional type and then *args and **kwargs, I want to type hint a Callable for which is known: It must have at least 1 positional input. The first positional input must be int. It must return…
Hyperplane
  • 1,422
  • 1
  • 14
  • 28
2
votes
3 answers

No attribute "execute" error on connecting to PostgreSQL

I have my postgres installed on PC1 and I am connecting to the database using PC2. I have modified the settings so that postgres on PC1 is accessible to local network. On PC2 I am doing the following: import pandas as pd, pyodbc from sqlalchemy…
Zanam
  • 4,607
  • 13
  • 67
  • 143
2
votes
1 answer

InterfaceError: cursor already closed

We have a Django 4.0.4 site running. Since upgrading from Python 3.10->3.11 and Psycopg2 from 2.8.6->2.9.3/5 and gunicorn 20.0.4->20.1.0 we've been getting random InterfaceError: cursor already closed errors on random parts of our codebase. Rarely…
Kushboy
  • 43
  • 1
  • 5
2
votes
1 answer

why does dict({4:None}) returns {4: None} but dict([{4,None}]) returns {None: 4} in Python 3.11

I was fiddling with dict() and found out that when I do >>> dict({4:None}) it returns {4: None} which is expected but, when I try converting a list containing a nested set [{4,None}] >>> dict([{4,None}]) returns {None: 4} which genuinely…
2
votes
2 answers

Why sum function is slower if the 'start' argument is an instance of custom class?

I was playing around with sum function and observed the following behaviour. case 1: source = """ class A: def __init__(self, a): self.a = a def __add__(self, other): return self.a + other; sum([*range(10000)],…
Abdul Niyas P M
  • 18,035
  • 2
  • 25
  • 46
2
votes
1 answer

How do i install pygame on python 3.11.0 it's showing the following error

Whenever i try to install pygame, it says it has error: subprocess-exited-with-error python setup.py egg_info did not run successfully. exit code 1
Samman Regmi
  • 21
  • 1
  • 1
  • 3
2
votes
0 answers

pip install "moduleNotFound" error in .venv after Installing / upgrading-to Python 3.11 on macOS with pyenv

I use pyenv (installed with homebrew) to manage my macOS python-versions. Python 3.11 just came out, but pyenv doesn't see this version. However from googling it appears others are able to see/install it. How to fix? This caused me some trouble, so…
P i
  • 29,020
  • 36
  • 159
  • 267
1
vote
2 answers

Python does not return a variable

I have a code for a self-service checkout: price = {'meat': 3, 'bread': 1, 'potato': 0.5, 'water': 0.2} def buy(): pay = 0 while True: enter = input('Что покупаем???\n') if enter == 'end': break pay +=…
1
vote
1 answer

Paddles on my Pong game do not move after pressing the keys on Python 3.11 Turtle Graphics

Main.py: from turtle import Screen from Paddle import Paddle #creating screen screen = Screen() screen.screensize(1000, 600) screen.bgcolor('black') screen.title('Pong') screen.tracer(0) #paddle objects: rPaddle is for the paddle in the right and…
1
vote
0 answers

Python 3.11, pipenv éditable package

I have my python 3.11 project here: E:/DEV/CUSTOMER/MYPROJECT I have created virtualenv inside my project with PIPENV_VENV_IN_PROJECT so my virtual env is in E:/DEV/CUSTOMER/MYPROJECT/.venv I have another package in E:/DEV/CUSTOMER/MYPACKAGE I…
jeyzorus
  • 85
  • 9
1 2
3
20 21