You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am guessing this is a python 3.12 issue possibly. This library worked for me before using VSCODE on Windows 11, but it is possible that this was before I removed other versions of Python. It is possible that when it worked, I had python 3.11 targeted as the interpreter.
Is there a fix for 3.12 or do I have to downgrade my Python install?
The error... NameError: name 'constants' is not defined throws when importing qrcode, as in import qrcode.
Error details is below.
Thanks
C:\Users\user>py -0p
-V:3.12 * C:\Program Files\Python312\python.exe
C:\Users\user>python -m pip list
Package Version
----------------- ------------
attrs 24.2.0
brother-ql 0.9.4
click 8.1.7
colorama 0.4.6
future 1.0.0
packbits 0.6
pillow 10.4.0
pip 24.2
pypng 0.20220715.0
pyusb 1.2.1
qrcode 7.4.2
typing_extensions 4.12.2
C:\Users\user>py -m pip show qrcode
Name: qrcode
Version: 7.4.2
Summary: QR Code image generator
Home-page: https://github.com/lincolnloop/python-qrcode
Author: Lincoln Loop
Author-email: [email protected]
License: BSD
Location: C:\Program Files\Python312\Lib\site-packages
Requires: colorama, pypng, typing-extensions
Required-by:
C:\Users\user>py
Python 3.12.6 (tags/v3.12.6:a4a2d2b, Sep 6 2024, 20:11:23) [MSC v.1940 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import qrcode
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Program Files\Python312\Lib\site-packages\qrcode\__init__.py", line 1, in <module>
from qrcode.main import QRCode
File "C:\Program Files\Python312\Lib\site-packages\qrcode\main.py", line 80, in <module>
class QRCode(Generic[GenericImage]):
File "C:\Program Files\Python312\Lib\site-packages\qrcode\main.py", line 87, in QRCode
error_correction=constants.ERROR_CORRECT_M,
^^^^^^^^^
NameError: name 'constants' is not defined
>>> exit()
To reproduce, open a windows command line terminal, enter a python REPL environment by typing python and pressing enter, then try import qrcode and press enter.
The text was updated successfully, but these errors were encountered:
I am guessing this is a python 3.12 issue possibly. This library worked for me before using VSCODE on Windows 11, but it is possible that this was before I removed other versions of Python. It is possible that when it worked, I had python 3.11 targeted as the interpreter.
Is there a fix for 3.12 or do I have to downgrade my Python install?
The error...
NameError: name 'constants' is not defined
throws when importing qrcode, as inimport qrcode
.Error details is below.
Thanks
From qrcode\main.py (snippet)
To reproduce, open a windows command line terminal, enter a python REPL environment by typing python and pressing enter, then try import qrcode and press enter.
The text was updated successfully, but these errors were encountered: