chenjiexu / pyzxing Goto Github PK
View Code? Open in Web Editor NEWPython wrapper of ZXing Java library, making qrcode decoding super easy!
License: MIT License
Python wrapper of ZXing Java library, making qrcode decoding super easy!
License: MIT License
识别一张图片要1秒,而zbar是150毫秒。我看了下代码,是不是每次识别不同的图片都要重新用java -jar运行zxing,这样每次重新加载下zxing会影响速度。是不是可以建一个zxing的进程,然后和这个进程通讯(比如用zeromq)来解码。
Which visual codes types are supported to be decoded with the pyzxing wrapper?
Is working with DataMatrix types available, for example?
Hello ! Thank you for your work.
I am testing your wrapper with some images and for a image with no barcode I got this error:
Traceback (most recent call last):
File "pyzxing/scanner.py", line 27, in
main(args)
File "pyzxing/scanner.py", line 16, in main
results_string = [result['parsed'] for result in results]
File "pyzxing/scanner.py", line 16, in
results_string = [result['parsed'] for result in results]
KeyError: 'parsed'
1.run in python get errot result:
Use local jar file.
'java' �����ڲ����ⲿ���Ҳ���ǿ����еij���
���������ļ���
2.use CMD:C:\Users\XXX>java -jar C:\Users\XXX\.local\javase-3.4.1-SNAPSHOT-jar-with-dependencies.jar C:\Users\XXX\.local\test\*.png:
Exception in thread "main" java.lang.IllegalArgumentException: URI is not hierarchical
at java.base/sun.nio.fs.WindowsUriSupport.fromUri(WindowsUriSupport.java:122)
at java.base/sun.nio.fs.WindowsFileSystemProvider.getPath(WindowsFileSystemProvider.java:97)
at java.base/java.nio.file.Path.of(Path.java:203)
at java.base/java.nio.file.Paths.get(Paths.java:98)
at com.google.zxing.client.j2se.CommandLineRunner.expand(CommandLineRunner.java:112)
at com.google.zxing.client.j2se.CommandLineRunner.main(CommandLineRunner.java:76)
于是我尝试第二种方式,我在pyzxing目录下执行git submodule init,git submodule update第二条命令又失败了,fatal: 无法克隆 'https://github.com/zxing/zxing' 到子模组路径 '/home/jayjia/桌面/demo/zxing/javase/python-zxing/pyzxing/zxing'
第二次尝试克隆 'zxing' 失败,退出
Operating System: Ubuntu 22.04
Python version: 3.10.6
.venv dump (pip freeze
) - also contains other QR detection libraries which were tested:
joblib==1.2.0
numpy==1.24.3
opencv-python==4.7.0.72
py4j==0.10.9.7
PyBoof==0.41
pyzbar==0.1.9
pyzxing==1.0.2
segno==1.5.2
six==1.16.0
transforms3d==0.4.1
I was testing the performance of various QR code detection libraries using "perfect" version 1-H QR codes generated by segno
, and I noticed that some of these codes could not be detected. In particular, the following 192 values failed to be detected when testing exhaustively in the range
1982, 2189, 2429, 4041, 4135, 4598, 4608, 4705, 5468, 6310, 6466, 6620, 6904, 7418, 9983, 10279, 11066, 11561, 13451, 14861, 14940, 15105, 16171, 16697, 17199, 17237, 17367, 18125, 18249, 18251, 18331, 19198, 19295, 19485, 20451, 21842, 22820, 22975, 23030, 23110, 23389, 23502, 23577, 24380, 24403, 24537, 24836, 25114, 25393, 25481, 26545, 26668, 26783, 26872, 27075, 27649, 29342, 29744, 29759, 30473, 31283, 32182, 33687, 33982, 34427, 35288, 36713, 36731, 37872, 38155, 38630, 39141, 39892, 40506, 41855, 42022, 42536, 42918, 43036, 43452, 44255, 44300, 47121, 47681, 48830, 48942, 49808, 49992, 50922, 52182, 53588, 54099, 54441, 54635, 55294, 55540, 55802, 56831, 57003, 57950, 58161, 58240, 58815, 60599, 60826, 60915, 61078, 61569, 61612, 62202, 62457, 62710, 63392, 64002, 64632, 65289, 65742, 66070, 66175, 66495, 67268, 67345, 67861, 68142, 69169, 69772, 69991, 70558, 70585, 72597, 72769, 73250, 73726, 74664, 74729, 75836, 76625, 77483, 77574, 77762, 77906, 78091, 78339, 78350, 78626, 78678, 78889, 78922, 79267, 79726, 79889, 80122, 80483, 80615, 80680, 80886, 80930, 81243, 81315, 81862, 82485, 82509, 82600, 84801, 85762, 86122, 87319, 87729, 89386, 89478, 89996, 90458, 90709, 90938, 91397, 91541, 92479, 93120, 93287, 94030, 94865, 95290, 95342, 95377, 95700, 95815, 96620, 97158, 98549, 98665, 99579, 99794
This issue was not exclusive to pyzxing, and other tested libraries such as OpenCV
and BoofCV
also had issues with some payloads (although for different values), which are confirmed as a bug due to false positives in the finder pattern (which may or may not be the same issue in this case) - see lessthanoptimal/PyBoof#23. Please note that there is also an identified bug in segno
in which the padding is malformed for 4-digit payloads - see heuer/segno#123, although this does not seem to affect pyzxing as I'm assuming you ignore the padding bits (which seems to be a strategy employed by many detector libraries).
import cv2
import segno
from pyzxing import BarCodeReader
TEST_FILE = 'qr_test.png'
reader = BarCodeReader()
bad_detections = []
for i in range(0, 100000):
qrcode = segno.make(i, version=1)
assert qrcode.error == 'H'
qrcode.save(TEST_FILE, scale = 5)
img = cv2.imread(TEST_FILE)
img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
img = cv2.resize(img, (88, 88))
barcodes = reader.decode_array(img)
assert len(barcodes) == 1
if 'raw' not in barcodes[0]:
print(f"Unable to detect {i}")
bad_detections.append(i)
else:
assert barcodes[0]['raw'].decode("utf-8") == str(i), f"Mismatch between detected value {barcodes[0]['raw'].decode("utf-8")} and input {x}"
print(f"Unable to detect the following data payloads:\n{bad_detections}")
Hi,
I needed to modify decoding step in https://github.com/dlenski/python-zxing to try different encodings.
Does you python wrapper do it automatically by reading ECI field? Or is zxing doing it correctly automatically.
Exception has occurred: UnicodeDecodeError
'utf-8' codec can't decode byte 0xe8 in position 67: invalid continuation byte
I made a simple wrapper to handle the file format QR code:
def _decode(self, filename):
try:
# the origin code
cmd = ' '.join([self.command, self.lib_path, 'file:///' + filename, '--multi'])
(stdout, _) = subprocess.Popen(cmd,
stdout=subprocess.PIPE,
universal_newlines=True,
shell=True).communicate()
lines = stdout.splitlines()
separator_idx = [
i for i in range(len(lines)) if lines[i][:4] == 'file'
] + [len(lines)]
result = [
self._parse_single(lines[separator_idx[i]:separator_idx[i + 1]])
for i in range(len(separator_idx) - 1)
]
except:
# my add-in code
cmd = ' '.join([self.command, self.lib_path, 'file:///' + filename, '--multi'])
(lines, _) = subprocess.Popen(cmd,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE).communicate()
result = lines[lines.index(b'Raw result:\n')+len(b'Raw result:\n'):lines.index(b'\nFound')]
return result
This will return the 'Raw result' bytes while the result can't be decoded with the default character set.
Hello i have simple but annoying question that i couldn't found answer for. I got result in a form like '{filename': ''filename.jpg, 'format': b'QR_CODE', 'type': b'URI', 'raw': b'raw_data', 'parsed': b'parsed_data', 'points': [(435.0, 378.5), (433.0, 271.0), (545.5, 267.66666), (527.25, 359.5)]}
I need to draw border around found barcode so how do i know what these numbers inside 'points' list means?
有的二维码微信可以识别但是用pyzxing识别不出来,这样下去什么时候能打破鹅厂的垄断,客户很不满,让我来发issue,理解一下
您好,我想请教使用pyzxing进行开发时遇到的问题,使用绝对路径会报错/找不到文件,使用绝对路径则能正常识别,具体情况如下:
执行python scanner.py -f D:/pyzxing/images/codabar.png报错:
at java.net.URL.<init>(Unknown Source)
at java.net.URL.<init>(Unknown Source)
at java.net.URL.<init>(Unknown Source)
at com.google.zxing.client.j2se.ImageReader.readImage(ImageReader.java:44)
at com.google.zxing.client.j2se.DecodeWorker.decode(DecodeWorker.java:125)
at com.google.zxing.client.j2se.DecodeWorker.call(DecodeWorker.java:76)
执行python scanner.py -f file:///D:/pyzxing/images/codabar.png输出:File not found!
执行python scanner.py -f images/codabar.png则能正常识别
Hi,
I'm working on code-words error correction algorithm as part of my thesis. I need to show a demo but didn't find any good pure python qrcode reader and my understanding with this library is limited. I just want to quickly know how to get detected code words. Can somebody point me in this library to get detected codewords, preferably as an array, before feeding them for error correction.
Thanks!
Do you have an example of how to generate a data matrix and configure image height and width (number of pixels)?
``你好,我在按README.md安装pyzxing的时候遇到了一些问题。
首先是运行测试脚本
python -m unittest tests.test_decode
得到了如下结果: FAILED (failures=2, errors=6)
Exception in thread "main" java.lang.IllegalArgumentException: Bad escape
at sun.nio.fs.UnixUriUtils.fromUri(UnixUriUtils.java:87)
at sun.nio.fs.UnixFileSystemProvider.getPath(UnixFileSystemProvider.java:98)
at java.nio.file.Paths.get(Paths.java:138)
at com.google.zxing.client.j2se.CommandLineRunner.expand(CommandLineRunner.java:112)
at com.google.zxing.client.j2se.CommandLineRunner.main(CommandLineRunner.java:76)
EException in thread "main" java.lang.IllegalArgumentException: Bad escape
at sun.nio.fs.UnixUriUtils.fromUri(UnixUriUtils.java:87)
at sun.nio.fs.UnixFileSystemProvider.getPath(UnixFileSystemProvider.java:98)
at java.nio.file.Paths.get(Paths.java:138)
at com.google.zxing.client.j2se.CommandLineRunner.expand(CommandLineRunner.java:112)
at com.google.zxing.client.j2se.CommandLineRunner.main(CommandLineRunner.java:76)
EException in thread "main" java.lang.IllegalArgumentException: Bad escape
at sun.nio.fs.UnixUriUtils.fromUri(UnixUriUtils.java:87)
at sun.nio.fs.UnixFileSystemProvider.getPath(UnixFileSystemProvider.java:98)
at java.nio.file.Paths.get(Paths.java:138)
at com.google.zxing.client.j2se.CommandLineRunner.expand(CommandLineRunner.java:112)
at com.google.zxing.client.j2se.CommandLineRunner.main(CommandLineRunner.java:76)
EException in thread "main" java.lang.IllegalArgumentException: Bad escape
at sun.nio.fs.UnixUriUtils.fromUri(UnixUriUtils.java:87)
at sun.nio.fs.UnixFileSystemProvider.getPath(UnixFileSystemProvider.java:98)
at java.nio.file.Paths.get(Paths.java:138)
at com.google.zxing.client.j2se.CommandLineRunner.expand(CommandLineRunner.java:112)
at com.google.zxing.client.j2se.CommandLineRunner.main(CommandLineRunner.java:76)
FException in thread "main" java.lang.IllegalArgumentException: Bad escape
at sun.nio.fs.UnixUriUtils.fromUri(UnixUriUtils.java:87)
at sun.nio.fs.UnixFileSystemProvider.getPath(UnixFileSystemProvider.java:98)
at java.nio.file.Paths.get(Paths.java:138)
at com.google.zxing.client.j2se.CommandLineRunner.expand(CommandLineRunner.java:112)
at com.google.zxing.client.j2se.CommandLineRunner.main(CommandLineRunner.java:76)
Exception in thread "main" java.lang.IllegalArgumentException: Bad escape
at sun.nio.fs.UnixUriUtils.fromUri(UnixUriUtils.java:87)
at sun.nio.fs.UnixFileSystemProvider.getPath(UnixFileSystemProvider.java:98)
at java.nio.file.Paths.get(Paths.java:138)
at com.google.zxing.client.j2se.CommandLineRunner.expand(CommandLineRunner.java:112)
at com.google.zxing.client.j2se.CommandLineRunner.main(CommandLineRunner.java:76)
Exception in thread "main" java.lang.IllegalArgumentException: Bad escape
at sun.nio.fs.UnixUriUtils.fromUri(UnixUriUtils.java:87)
at sun.nio.fs.UnixFileSystemProvider.getPath(UnixFileSystemProvider.java:98)
at java.nio.file.Paths.get(Paths.java:138)
at com.google.zxing.client.j2se.CommandLineRunner.expand(CommandLineRunner.java:112)
at com.google.zxing.client.j2se.CommandLineRunner.main(CommandLineRunner.java:76)
Exception in thread "main" java.lang.IllegalArgumentException: Bad escape
at sun.nio.fs.UnixUriUtils.fromUri(UnixUriUtils.java:87)
at sun.nio.fs.UnixFileSystemProvider.getPath(UnixFileSystemProvider.java:98)
at java.nio.file.Paths.get(Paths.java:138)
at com.google.zxing.client.j2se.CommandLineRunner.expand(CommandLineRunner.java:112)
at com.google.zxing.client.j2se.CommandLineRunner.main(CommandLineRunner.java:76)
Exception in thread "main" java.lang.IllegalArgumentException: Bad escape
at sun.nio.fs.UnixUriUtils.fromUri(UnixUriUtils.java:87)
at sun.nio.fs.UnixFileSystemProvider.getPath(UnixFileSystemProvider.java:98)
at java.nio.file.Paths.get(Paths.java:138)
at com.google.zxing.client.j2se.CommandLineRunner.expand(CommandLineRunner.java:112)
at com.google.zxing.client.j2se.CommandLineRunner.main(CommandLineRunner.java:76)
Exception in thread "main" java.lang.IllegalArgumentException: Bad escape
at sun.nio.fs.UnixUriUtils.fromUri(UnixUriUtils.java:87)
at sun.nio.fs.UnixFileSystemProvider.getPath(UnixFileSystemProvider.java:98)
at java.nio.file.Paths.get(Paths.java:138)
at com.google.zxing.client.j2se.CommandLineRunner.expand(CommandLineRunner.java:112)
at com.google.zxing.client.j2se.CommandLineRunner.main(CommandLineRunner.java:76)
FException in thread "main" java.lang.IllegalArgumentException: Bad escape
at sun.nio.fs.UnixUriUtils.fromUri(UnixUriUtils.java:87)
at sun.nio.fs.UnixFileSystemProvider.getPath(UnixFileSystemProvider.java:98)
at java.nio.file.Paths.get(Paths.java:138)
at com.google.zxing.client.j2se.CommandLineRunner.expand(CommandLineRunner.java:112)
at com.google.zxing.client.j2se.CommandLineRunner.main(CommandLineRunner.java:76)
E.Exception in thread "main" java.lang.IllegalArgumentException: Bad escape
at sun.nio.fs.UnixUriUtils.fromUri(UnixUriUtils.java:87)
at sun.nio.fs.UnixFileSystemProvider.getPath(UnixFileSystemProvider.java:98)
at java.nio.file.Paths.get(Paths.java:138)
at com.google.zxing.client.j2se.CommandLineRunner.expand(CommandLineRunner.java:112)
at com.google.zxing.client.j2se.CommandLineRunner.main(CommandLineRunner.java:76)
EException in thread "main" java.lang.IllegalArgumentException: Bad escape
at sun.nio.fs.UnixUriUtils.fromUri(UnixUriUtils.java:87)
at sun.nio.fs.UnixFileSystemProvider.getPath(UnixFileSystemProvider.java:98)
at java.nio.file.Paths.get(Paths.java:138)
at com.google.zxing.client.j2se.CommandLineRunner.expand(CommandLineRunner.java:112)
at com.google.zxing.client.j2se.CommandLineRunner.main(CommandLineRunner.java:76)
E
======================================================================
ERROR: test_codabar (tests.test_decode.TestBarCodeReaderDecode)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/media/lappy/文档/cv-practice/ZXing/pyzxing/tests/test_decode.py", line 16, in test_codabar
self.assertEqual(result[0]['parsed'], gt)
IndexError: list index out of range
======================================================================
ERROR: test_code128 (tests.test_decode.TestBarCodeReaderDecode)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/media/lappy/文档/cv-practice/ZXing/pyzxing/tests/test_decode.py", line 30, in test_code128
self.assertEqual(result[0]['parsed'], gt)
IndexError: list index out of range
======================================================================
ERROR: test_code39 (tests.test_decode.TestBarCodeReaderDecode)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/media/lappy/文档/cv-practice/ZXing/pyzxing/tests/test_decode.py", line 23, in test_code39
self.assertEqual(result[0]['parsed'], gt)
IndexError: list index out of range
======================================================================
ERROR: test_nobarcodefile (tests.test_decode.TestBarCodeReaderDecode)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/media/lappy/文档/cv-practice/ZXing/pyzxing/tests/test_decode.py", line 59, in test_nobarcodefile
self.assertEqual(result[0].get('parsed', None), None)
IndexError: list index out of range
======================================================================
ERROR: test_pdf417 (tests.test_decode.TestBarCodeReaderDecode)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/media/lappy/文档/cv-practice/ZXing/pyzxing/tests/test_decode.py", line 37, in test_pdf417
self.assertEqual(result[0]['parsed'], gt)
IndexError: list index out of range
======================================================================
ERROR: test_qrcode (tests.test_decode.TestBarCodeReaderDecode)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/media/lappy/文档/cv-practice/ZXing/pyzxing/tests/test_decode.py", line 44, in test_qrcode
self.assertEqual(result[0]['parsed'], gt)
IndexError: list index out of range
======================================================================
FAIL: test_multibarcodes (tests.test_decode.TestBarCodeReaderDecode)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/media/lappy/文档/cv-practice/ZXing/pyzxing/tests/test_decode.py", line 69, in test_multibarcodes
self.assertEqual(set(result_string), set(gt))
AssertionError: Items in the second set but not the first:
b'201541368446'
b'201541371885'
b'201541332863'
b'201541332768'
b'201541395223'
b'201541350294'
b'201541393029'
======================================================================
FAIL: test_multifiles (tests.test_decode.TestBarCodeReaderDecode)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/media/lappy/文档/cv-practice/ZXing/pyzxing/tests/test_decode.py", line 86, in test_multifiles
self.assertEqual(set(results_string), set(gt))
AssertionError: Items in the second set but not the first:
b'31117013206375'
b'[)>\x1e01\x1d96123450000\x1d222\x1d111\x1dMODE2'
b'-ActiveBarcode-ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890-ActiveBarcode-ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890-ActiveBarcode-ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890-ActiveBarcode-ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890-ActiveBarcode-ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890-ActiveBarcode-ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890'
b'When we at WRT talk about \\"text,\\" we are generally talking about a particular kind of readable information encoding - and readable is a complex proposition. Text may be stylized in a way we are unfamiliar with, as in blackletter - it may be interspersed with some markup we don\\\'t understand, such as HTML - it may be be a substitution system we aren\\\'t familiar with, such as braille or morse code - or it may be a system that, while technically human-readable, isn\\\'t particularly optimized for reading by humans, as with barcodes (although barcodes can be read).'
b'TEST-SHEET'
b'8101054321120021123456'
----------------------------------------------------------------------
Ran 9 tests in 5.651s
FAILED (failures=2, errors=6)
之后我运行了如下指令
git submodule init
git submodule update
cd zxing
mvn install -DskipTests
得到输出
……
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for ZXing 3.4.1-SNAPSHOT:
[INFO]
[INFO] ZXing .............................................. SUCCESS [ 21.216 s]
[INFO] ZXing Core ......................................... SUCCESS [ 43.372 s]
[INFO] ZXing Java SE extensions ........................... FAILURE [ 4.195 s]
[INFO] ZXing zxing.org web app ............................ SKIPPED
[INFO] ZXing Appspot-based encoder ........................ SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:09 min
[INFO] Finished at: 2022-03-02T16:20:19+08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.rat:apache-rat-plugin:0.13:check (default) on project javase: Too many files with unapproved license: 1 See RAT report in: /media/lappy/文档/cv-practice/ZXing/pyzxing/zxing/javase/target/rat.txt -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <args> -rf :javase
再接着运行
cd javase
mvn -DskipTests package assembly:single
得到输出
……
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.526 s
[INFO] Finished at: 2022-03-02T16:21:33+08:00
[INFO] ------------------------------------------------------------------------
运行示例代码,报错
Exception in thread "main" java.lang.IllegalArgumentException: Bad escape
at sun.nio.fs.UnixUriUtils.fromUri(UnixUriUtils.java:87)
at sun.nio.fs.UnixFileSystemProvider.getPath(UnixFileSystemProvider.java:98)
at java.nio.file.Paths.get(Paths.java:138)
at com.google.zxing.client.j2se.CommandLineRunner.expand(CommandLineRunner.java:112)
at com.google.zxing.client.j2se.CommandLineRunner.main(CommandLineRunner.java:76)
[]
我对没有了解过Java和maven,请问我该如何解决遇到的问题?
thanks for your great work!
when I ran pyzxing for one image and it cost more than two seconds on mac os.
Although multiple pictures parallel computing is very fast . (55pictures / 20s)
How much time do you spend on a single picture?
Is there something wrong with my environment?
I'm not sure if I'm worng, but is there a reason why i can´t get the resultpoints at the moment? Because it
looks like result['points'] = [ast.literal_eval(line[12:]) for line in lines[points_index+1:-1]]
it is not working
Hi , I have tried pyzxing0.3.5 and it's very good! Thanks!
But it seems there are some little errors in it.
When i used [maxicode] picture for test, both of decode[array] and decode [filename], will get this error.
But pyzxing0.3.3 can recognize maxicode successfully! (0.3.4 also❌ )
Originally posted by @zhaozhen1002 in #17 (comment)
Thank you! It seems that points information can't be parsed successfully. I will look into it.
Collecting pyzxing
Downloading pyzxing-0.3.1.tar.gz (6.7 kB)
DEPRECATION: The -b/--build/--build-dir/--build-directory option is deprecated. pip 20.3 will remove support for this functionality. A possible replacement is use the TMPDIR/TEMP/TMP environment variable, possibly combined with --no-clean. You can find discussion regarding this at https://github.com/pypa/pip/issues/8333.
ERROR: Command errored out with exit status 1:
command: /home/dinko/Projects/python-exercises/venv/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pycharm-packaging/pyzxing/setup.py'"'"'; __file__='"'"'/tmp/pycharm-packaging/pyzxing/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-g_75g7jf
cwd: /tmp/pycharm-packaging/pyzxing/
Complete output (5 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pycharm-packaging/pyzxing/setup.py", line 5, in <module>
with open('requirements.txt') as f:
FileNotFoundError: [Errno 2] No such file or directory: 'requirements.txt'
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
Can't install using pip because requirements.txt
is not included in source.
For this spicific QR_CODE reader.decode() fails with error :
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/arion/.local/lib/python3.8/site-packages/pyzxing/reader.py", line 45, in decode
results = self._decode(filenames[0].replace('\\', '/'))
File "/home/arion/.local/lib/python3.8/site-packages/pyzxing/reader.py", line 61, in _decode
result = [self._parse_single(
File "/home/arion/.local/lib/python3.8/site-packages/pyzxing/reader.py", line 61, in <listcomp>
result = [self._parse_single(
File "/home/arion/.local/lib/python3.8/site-packages/pyzxing/reader.py", line 90, in _parse_single
result['points'] = [ast.literal_eval(
File "/home/arion/.local/lib/python3.8/site-packages/pyzxing/reader.py", line 90, in <listcomp>
result['points'] = [ast.literal_eval(
File "/usr/lib/python3.8/ast.py", line 59, in literal_eval
if isinstance(node_or_string, Expression):
File "/usr/lib/python3.8/ast.py", line 47, in parse
return compile(source, filename, mode, flags, _feature_version=feature_version)
File "<unknown>", line 1
param1):
^
SyntaxError: unmatched ')'
Here's my code -
>>> from pyzxing import BarCodeReader
>>> reader = BarCodeReader()
Use local jar file.
>>> reader.decode('8RXzm7LJ.png')
/* Errors */
Here's the decoded output, decoded in the xzing website -
param0 = "2XEY1jQ1gZv8f03Y8juNiXOHgXTymJtO"
param1 = "XRrI4mjQvdrfCRPsleVI2jK7ySHp1EXa"
param2 = 690
output = ""
o = False
i = 0
for c0, c1 in zip(param0, param1):
if i % 2 == 0:
cc = c0 + c1
if cc.isnumeric() and o is False:
o = True
meh = param0 + str(param2) + param1
for j in range(0, i * param2):
x = 13
if j % 2 == 0:
x = 77
output += meh[(j + x) % len(meh)]
output = output[::-1]
else:
output += cc
output = output[::-1]
else:
if ord(c0) == ord(c1):
output += c1 + c0
elif ord(c0) > ord(c1):
output += c0
else:
output += c1
i += 1
output = output[0:32]
print(output)
It works in the xzing website. and pyzxing works fine for the other 10 or so QR_CODEs I've tested it for.
Can you increase on Micro QR Code for use of the API
作者您好,我发现有些条码pyzxing无法识别,但zxing的online版本可以识别出来,不知为啥。
如果用pyinstaller打包,jar文件可以放在哪个文件夹里?
I'm getting an error when running the scanner.py
script on the back of my ID card. Here's the traceback:
python scanner.py -f dl_back.jpg
Use local jar file.
Traceback (most recent call last):
File "/Users/vlsd/projects/my_project/scanner.py", line 27, in <module>
main(args)
File "/Users/vlsd/projects/my_project/scanner.py", line 13, in main
results = reader.decode(args.file)
File "/Users/vlsd/projects/my_project/.venv/lib/python3.9/site-packages/pyzxing/reader.py", line 45, in decode
results = self._decode(filenames[0].replace('\\', '/'))
File "/Users/vlsd/projects/my_project/.venv/lib/python3.9/site-packages/pyzxing/reader.py", line 61, in _decode
result = [self._parse_single(
File "/Users/vlsd/projects/my_project/.venv/lib/python3.9/site-packages/pyzxing/reader.py", line 61, in <listcomp>
result = [self._parse_single(
File "/Users/vlsd/projects/my_project/.venv/lib/python3.9/site-packages/pyzxing/reader.py", line 90, in _parse_single
result['points'] = [ast.literal_eval(
File "/Users/vlsd/projects/my_project/.venv/lib/python3.9/site-packages/pyzxing/reader.py", line 90, in <listcomp>
result['points'] = [ast.literal_eval(
File "/Users/vlsd/.pyenv/versions/3.9.0/lib/python3.9/ast.py", line 105, in literal_eval
return _convert(node_or_string)
File "/Users/vlsd/.pyenv/versions/3.9.0/lib/python3.9/ast.py", line 104, in _convert
return _convert_signed_num(node)
File "/Users/vlsd/.pyenv/versions/3.9.0/lib/python3.9/ast.py", line 78, in _convert_signed_num
return _convert_num(node)
File "/Users/vlsd/.pyenv/versions/3.9.0/lib/python3.9/ast.py", line 69, in _convert_num
_raise_malformed_node(node)
File "/Users/vlsd/.pyenv/versions/3.9.0/lib/python3.9/ast.py", line 66, in _raise_malformed_node
raise ValueError(f'malformed node or string: {node!r}')
ValueError: malformed node or string: <ast.Name object at 0x109b54a00>
I wonder if Python 3.9 introduced some breaking changes to how ast
behaves?
Hello,
When installed with the pip command, the download link is invalid :
jar_url = "https://github.com/ChenjieXu/pyzxing/releases/download/v0.1/"
should be instead
jar_url = "https://github.com/ChenjieXu/pyzxing/releases/v0.1/"
Best regards
Hello,
Thanks for your contribution, is it also possible to generate QR codes?
My code:
codes = reader.decode(r"C:\\Users\\oscar\\Projects\\Camera Project\\captures\\barcode_Color.png")
The error message:
Exception in thread "main" java.util.concurrent.ExecutionException: javax.imageio.IIOException: Can't get input stream from URL!
at java.util.concurrent.FutureTask.report(Unknown Source)
at java.util.concurrent.FutureTask.get(Unknown Source)
at com.google.zxing.client.j2se.CommandLineRunner.main(CommandLineRunner.java:96)
Caused by: javax.imageio.IIOException: Can't get input stream from URL!
at javax.imageio.ImageIO.read(Unknown Source)
at com.google.zxing.client.j2se.ImageReader.readImage(ImageReader.java:44)
at com.google.zxing.client.j2se.DecodeWorker.decode(DecodeWorker.java:125)
at com.google.zxing.client.j2se.DecodeWorker.call(DecodeWorker.java:76)
at com.google.zxing.client.j2se.DecodeWorker.call(DecodeWorker.java:56)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.io.FileNotFoundException: C:\Users\oscar\Projects\Camera (The system cannot find the file specified)
at java.io.FileInputStream.open0(Native Method)
at java.io.FileInputStream.open(Unknown Source)
at java.io.FileInputStream.<init>(Unknown Source)
at java.io.FileInputStream.<init>(Unknown Source)
at sun.net.www.protocol.file.FileURLConnection.connect(Unknown Source)
at sun.net.www.protocol.file.FileURLConnection.getInputStream(Unknown Source)
at java.net.URL.openStream(Unknown Source)
... 9 more
Specifically this line:
Caused by: java.io.FileNotFoundException: C:\Users\oscar\Projects\Camera (The system cannot find the file specified)
Does it support the recognition of multiple QR codes in a picture?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.