Open karolyi opened 7 years ago
Another bug report for this issue:
` In [13]: from pystrich.qrcode import QRCodeEncoder
IndexError Traceback (most recent call last)
Also having this problem.
@MrSurly @edkirin and anyone else who has this problem, consider changing to https://github.com/lincolnloop/python-qrcode
@karolyi Thanks for info, I will check this lib.
@karolyi I was looking for a generic library that does DMTX and QR, since my present QR generator makes rather large codes that don't print very clearly on my tiny labels.
@MrSurly I feel you. I also wanted to use a more generic purpose data code imager library like this, but since this doesn't work and seemingly has no support, I was forced to change to the other one.
@karolyi I'm probably also going to change over -- has more control over the final size of the QR code, which is what I'm looking for, though I would like an API for accessing the individual pixels.
I've had a look at this today. Ultimately, the code of this project is a mess and the tests are too high level to really help narrow down what's going on. This library is a Python 3 port of huBarcode (itself seemingly abandoned), with various improvements, but certainly not a re-write. If you run git blame on the responsible lines of code, you'll see that most of them are over a decade old.
I regularly use the code39, code128 and datamatrix aspects of this library, so I know those are relatively battle tested. I don't use the ean or qrcode parts. I've got some knowledge about how code39, code128 and datamatrix work and I've read a good chunk of the standardisation documentation about them. I know almost nothing about qrcode.
It looks to me like this bug only affects certain strings. It disappears by changing the case of the letter B in B-4-1-20170805-6 or changing one of the digits in 00231872347699829948. Digging deeper, it appears that error originates from the error correction codewords being 1 word too short. Everything else like the padding looks fine to me (again, I'm no expert).
So you're more than welcome to find the root cause and submit a patch. My recommendation would be to use a library that's better maintained for QR. The linked python-qrcode looks a lot cleaner to me in terms of implementation (no reliance on mysterious .dat files) - I can actually understand what's going on. I'd ideally drop QR support from this library, but I know people are using it.
This project is unlikely to receive major updates. I'd favour a re-write over trying to improve most of the existing code - this is something else that I don't currently have time for.
EDIT: Forgot to add. This bug is also present in huBarcode, so is unrelated to the port to Python 3. I haven't found a bug report for it though.
My workaround was just to iterate through the various levels of redundancy until it passes. I only used used it for small numbers though.
Hey,
I'm trying to convert the string 'B-4-1-20170805-6' into a QR-Code, but pyStrich raises an error:
please investigate.
cheers