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

Ugly error for nonexisting file #773

Closed
vargenau opened this issue Nov 23, 2023 · 1 comment · Fixed by #777
Closed

Ugly error for nonexisting file #773

vargenau opened this issue Nov 23, 2023 · 1 comment · Fixed by #777

Comments

@vargenau
Copy link
Contributor

File foo.spdxdoes not exist.
Running:

pyspdxtools -i foo.spdx

results in the ugly error below.
Only the last line telling that the file does not exist should be displayed.

Traceback (most recent call last):
  File "/opt/homebrew/bin/pyspdxtools", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/spdx_tools/spdx/clitools/pyspdxtools.py", line 61, in main
    document: Document = parse_file(infile)
                         ^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/spdx_tools/spdx/parser/parse_anything.py", line 25, in parse_file
    return tagvalue_parser.parse_from_file(file_name)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/spdx_tools/spdx/parser/tagvalue/tagvalue_parser.py", line 10, in parse_from_file
    with open(file_name) as file:
         ^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: 'foo.spdx'
@armintaenzertng
Copy link
Collaborator

Thanks for the input, @vargenau! :)
I opened #777 to fix this.

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

Successfully merging a pull request may close this issue.

2 participants