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

Missing file reported poorly for <sourcecode src=...> #1125

Open
1 task done
jennifer-richards opened this issue May 14, 2024 · 0 comments
Open
1 task done

Missing file reported poorly for <sourcecode src=...> #1125

jennifer-richards opened this issue May 14, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@jennifer-richards
Copy link
Member

Describe the issue

Encountered in debugging ietf-tools/datatracker#7405, a missing file referred to by the src attribute in a <sourcecode> element results in

/Users/jennifer/ietf/tmp/draft-ietf-sidrops-aspa-profile.xml(169): Error: Expected an <sourcecode> src= file at '/Users/jennifer/ietf/tmp/RPKI-ASPA-2023.asn', but no such file exists
Traceback (most recent call last):
  File "/Users/jennifer/Library/Python/3.11/bin/xml2rfc", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/Users/jennifer/Library/Python/3.11/lib/python/site-packages/xml2rfc/run.py", line 727, in main
    xmlrfc.tree = prep.prep()
                  ^^^^^^^^^^^
  File "/Users/jennifer/Library/Python/3.11/lib/python/site-packages/xml2rfc/writers/preptool.py", line 220, in prep
    tree = self.dispatch(self.selectors)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jennifer/Library/Python/3.11/lib/python/site-packages/xml2rfc/writers/base.py", line 1931, in dispatch
    func(e, e.getparent())
  File "/Users/jennifer/Library/Python/3.11/lib/python/site-packages/xml2rfc/writers/preptool.py", line 1952, in element_sourcecode
    self.normalize_whitespace(e)
  File "/Users/jennifer/Library/Python/3.11/lib/python/site-packages/xml2rfc/writers/preptool.py", line 201, in normalize_whitespace
    lines = e.text.split('\n')
            ^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'split'

There is a reasonable error at the top, but it's hidden before the stack trace and unhelpful details about a follow-on exception.

Really ought to end with "no such file exists" (and perhaps clean up the syntax of that error a bit)

Code of Conduct

@jennifer-richards jennifer-richards added the bug Something isn't working label May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant