jodal / biip

📦 Biip interprets the data in barcodes.
https://biip.readthedocs.io
Apache License 2.0
44 stars 3 forks source link

TypeError raised when parsing gtin in 3.2.0 #295

Closed yaser-fyndiq closed 4 weeks ago

yaser-fyndiq commented 1 month ago

Hello,

I tried parsing the same gtin value in 3.1.0 and 3.2.0 and it seems that 3.2.0 is raising an unhandled exception. Maybe this is related to https://github.com/jodal/biip/pull/292?

jodal commented 1 month ago

I'm on vacation right now, but will get back to you on this one once I'm back.

jodal commented 4 weeks ago

I've release Biip 3.3.0 with a fix for this issue.

>>> from pprint import pprint
>>> import biip
>>> pprint(biip.parse("701197206489"))
ParseResult(value='701197206489',
            symbology_identifier=None,
            gtin=Gtin(value='701197206489',
                      format=GtinFormat.GTIN_12,
                      prefix=GS1Prefix(value='070', usage='GS1 US'),
                      company_prefix=GS1CompanyPrefix(value='0701197'),
                      payload='70119720648',
                      check_digit=9,
                      packaging_level=None),
            gtin_error=None,
            upc=Upc(value='701197206489',
                    format=UpcFormat.UPC_A,
                    number_system_digit=7,
                    payload='70119720648',
                    check_digit=9),
            upc_error=None,
            sscc=None,
            sscc_error="Failed to parse '701197206489' as SSCC: Expected 18 "
                       'digits, got 12.',
            gs1_message=None,
            gs1_message_error='Failed to parse GS1 AI (7011) date/time from '
                              "'972064'.")
yaser-fyndiq commented 3 weeks ago

Awesome work @jodal. Thank you!