qrtools
qrtools copied to clipboard
Cannot find 'QR' from 'qrtools'
Just a message for those that are having trouble with from qrtools import QR
or import qrtools; qrtools.QR()
I am using windows (py 3.5.0) and I got it to work by using:
from qrtools.qrtools import QR
As opposed to what the installation docs say.
Also; there seems to be a problem with the package 'zbar' as I cannot install it on my Windows machine but that's a problem with the zbar package.
Thanx for the info skftn, this helped me out a lot...sort of. Still sitting with the zbar dependency now unfortunately. I found a zbar wrapper for python 3 which works, but not with this package obviously. Would it be possible to get these two to "work" together? Package name is zbar-ctypes
I have the same issue here, and your fix doesn't work (I use Linux)
Some wrong with zbar installation, which only compitable with python 2.6 and bellow
If you are Mac OS user then do the following [1]: $ brew install zbar $ export LDFLAGS="-L$(brew --prefix zbar)/lib" $ export CFLAGS="-I$(brew --prefix zbar)/include" $ pip install zbarlight
If Debian then: $ apt-get install libzbar0 libzbar-dev $ pip install zbarlight # you can also use setuptools directly
This would take care of zbar issue for Python 3.X users! Took me 1 hours just to find this easy solution!
After this inside your python script import the following: from qrtools import qrtools from PIL import Image import zbarlight
Reference: 1) https://github.com/Polyconseil/zbarlight/
Hi, the tips to use "from qrtools.qrtools import QR" helped me to resolve my problem but now i face another one who says : qr = qrtools.QR() NameError: name 'qrtools' is not defined
Do you have an idea to fix it ? Thanks.
Hi, the tips to use "from qrtools.qrtools import QR" helped me to resolve my problem but now i face another one who says : qr = qrtools.QR() NameError: name 'qrtools' is not defined
Do you have an idea to fix it ? Thanks.
Try installing the qrtools as mentioned here: https://github.com/primetang/qrtools
Thanks for the response, I've already done it with pip install qrtools and I've tried to clone the repo but nohting works. When i try to "import qrtools" I have the following error "qrtools has no module QR" and when I try to "from qrtools.qrtools import QR" I face the "name 'qrtools' is not defined" so I'm a bit lost ^^
from qrtools import qrtools qr = qrtools.QR()
from qrtools import qrtools qr = qrtools.QR()
It still give error: "ModuleNotFoundError: No module named 'zbar'" And I can't install zbar using pip: "ERROR: Command errored out with exit status 1: 'c:\users\astra\appdata\local\programs\python\python37-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\Astra\AppData\Local\Temp\pip-install-dfavmz_a\zbar\setup.py'"'"'; file='"'"'C:\Users\Astra\AppData\Local\Temp\pip-install-dfavmz_a\zbar\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record 'C:\Users\Astra\AppData\Local\Temp\pip-record-5p25l52d\install-record.txt' --single-version-externally-managed --compile Check the logs for full command output."
Please help
same here
Tried all the methods still have that error
well this post worked for me : https://www.codershubb.com/generate-or-read-qr-code-using-python/
Just use zbarlight (on Windows install it on WSL or try to compile it yourself):
from PIL import Image
import zbarlight
file_path = './qrcode.png'
with open(file_path, 'rb') as image_file:
image = Image.open(image_file)
image.load()
codes = zbarlight.scan_codes(['qrcode'], image)
print('QR codes: %s' % codes)
The other solution is to use pyzbar, fast and simple. https://thecleverprogrammer.com/2022/01/18/decode-a-qr-code-using-python/
If you are Mac OS user then do the following [1]: $ brew install zbar $ export LDFLAGS="-L$(brew --prefix zbar)/lib" $ export CFLAGS="-I$(brew --prefix zbar)/include" $ pip install zbarlight
If Debian then: $ apt-get install libzbar0 libzbar-dev $ pip install zbarlight # you can also use setuptools directly
This would take care of zbar issue for Python 3.X users! Took me 1 hours just to find this easy solution!
After this inside your python script import the following: from qrtools import qrtools from PIL import Image import zbarlight
Reference: 1) https://github.com/Polyconseil/zbarlight/
I've done this and I have zbar and zbarlight installed, ostensibly. But I still can't seem to get qrtools to find it.
O_O [dj@deepai:~] $ brew install zbar
Warning: zbar 0.23.90_4 is already installed and up-to-date.
To reinstall 0.23.90_4, run:
brew reinstall zbar
^_^ [dj@deepai:~] $ python
Python 3.12.0 (main, Dec 20 2023, 20:30:42) [Clang 15.0.0 (clang-1500.0.40.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from qrtools import qrtools
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/desco/.pyenv/versions/3.12.0/lib/python3.12/site-packages/qrtools/qrtools.py", line 28, in <module>
import zbar
ModuleNotFoundError: No module named 'zbar'
>>> from PIL import Image
>>> import zbarlight
>>> from qrtools import qrtools
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/desco/.pyenv/versions/3.12.0/lib/python3.12/site-packages/qrtools/qrtools.py", line 28, in <module>
import zbar
ModuleNotFoundError: No module named 'zbar'
>>>