dlenski / python-zxing

python wrapper for the ZXing barcode library
GNU Lesser General Public License v3.0
121 stars 36 forks source link

fix KeyError for multiple barcodes results possibly containing None #18

Closed ArlindNocaj closed 2 years ago

ArlindNocaj commented 2 years ago

If you provide multiple images and some of them get None as a result from zxing, then the code failed with a Keyerror. This got resolved by checking for these None values when generating the ordered list of responses.

dlenski commented 2 years ago

@ArlindNocaj, 800bd1b should address the underlying issue you've identified.

Now, BarCodeReader.decode will return BarCode(uri="whatever", raw=None, format=None) (rather than None) when an image can't be parsed. Also includes tests to verify this.

ArlindNocaj commented 2 years ago

Thats great. In the meanwhile I created a library to process multiple barcodes on documents with jpype and zxing, without needing to parse text data: https://github.com/ArlindNocaj/document-barcodes