Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError raised when parsing gtin in 3.2.0 #295

Open
yaser-fyndiq opened this issue Jul 10, 2024 · 1 comment
Open

TypeError raised when parsing gtin in 3.2.0 #295

yaser-fyndiq opened this issue Jul 10, 2024 · 1 comment

Comments

@yaser-fyndiq
Copy link

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 #292?

  • With 3.1.0, it's working fine:
python
Python 3.12.0 (main, Oct 30 2023, 16:10:32) [Clang 15.0.0 (clang-1500.0.40.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import biip
>>> 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 get GS1 Application Identifier from '701197206489'.")
  • With 3.2.0, it's raising TypeError
$ python
Python 3.12.0 (main, Oct 30 2023, 16:10:32) [Clang 15.0.0 (clang-1500.0.40.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import biip
>>> biip.parse("701197206489")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "~/test/.venv/lib/python3.12/site-packages/biip/_parser.py", line 89, in parse
    parse_func(val, config, queue, result)
  File "~/test/.venv/lib/python3.12/site-packages/biip/_parser.py", line 236, in _parse_gs1_message
    result.gs1_message = GS1Message.parse(
                         ^^^^^^^^^^^^^^^^^
  File "~/test/.venv/lib/python3.12/site-packages/biip/gs1/_messages.py", line 76, in parse
    element_string = GS1ElementString.extract(
                     ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/test/.venv/lib/python3.12/site-packages/biip/gs1/_element_strings.py", line 151, in extract
    value = "".join(pattern_groups)
            ^^^^^^^^^^^^^^^^^^^^^^^
TypeError: sequence item 1: expected str instance, NoneType found
@jodal
Copy link
Owner

jodal commented Jul 16, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants