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

x12valid throwing TypeError: 'NoneType' object is not iterable #74

Open
pam-caton opened this issue Nov 8, 2021 · 0 comments
Open

x12valid throwing TypeError: 'NoneType' object is not iterable #74

pam-caton opened this issue Nov 8, 2021 · 0 comments

Comments

@pam-caton
Copy link

I've encountered the following error when a segment has an element defined as required and that element has subelements defined. When the entire element is missing (e.g. I receive a segment in an X221 file like PLB*123*20211108~ where element 3 is required and has sub-elements), then I receive the following error:

Traceback (most recent call last):
  File ".local/bin/x12valid", line 8, in <module>
    sys.exit(main())
  File ".local/lib/python3.6/site-packages/pyx12/scripts/x12valid.py", line 158, in main
    fd_997=fd_997, fd_html=fd_html, fd_xmldoc=None, map_path=args.map_path):
  File ".local/lib/python3.6/site-packages/pyx12/x12n_document.py", line 199, in x12n_document
    valid &= node.is_valid(seg, errh)
  File ".local/lib/python3.6/site-packages/pyx12/map_if.py", line 1013, in is_valid
    valid &= child_node.is_valid(None, errh)
  File ".local/lib/python3.6/site-packages/pyx12/map_if.py", line 1481, in is_valid
    for sub_ele in comp_data:
TypeError: 'NoneType' object is not iterable

To fix it, I wrapped a test above the for loop at line 1481 so that if comp_data is empty, it will skip the for-loop and continue to if not good_flag check.

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

1 participant