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

Valid SPDX cannot be converted from JSON to tag:value #774

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

Valid SPDX cannot be converted from JSON to tag:value #774

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

Comments

@vargenau
Copy link
Contributor

bug.spdx.json

File bug.spdx.jsonis valid SPDX:

pyspdxtools -i bug.spdx.json

But it cannot be converted to tag:value:

pyspdxtools -i bug.spdx.json -o bug.spdx
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 96, in main
    write_file(document, outfile, validate=False)
  File "/opt/homebrew/lib/python3.11/site-packages/spdx_tools/spdx/writer/write_anything.py", line 22, in write_file
    tagvalue_writer.write_document_to_file(document, file_name, validate)
  File "/opt/homebrew/lib/python3.11/site-packages/spdx_tools/spdx/writer/tagvalue/tagvalue_writer.py", line 39, in write_document_to_file
    write_document_to_stream(document, out, validate, drop_duplicates)
  File "/opt/homebrew/lib/python3.11/site-packages/spdx_tools/spdx/writer/tagvalue/tagvalue_writer.py", line 34, in write_document_to_stream
    write_document(document, stream)
  File "/opt/homebrew/lib/python3.11/site-packages/spdx_tools/spdx/writer/tagvalue/tagvalue_writer.py", line 43, in write_document
    relationships_to_write, contained_files_by_package_id = scan_relationships(
                                                            ^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/spdx_tools/spdx/writer/tagvalue/tagvalue_writer_helper_functions.py", line 89, in scan_relationships
    and relationship.related_spdx_element_id in files_by_spdx_id.keys()
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: unhashable type: 'SpdxNoAssertion'
@armintaenzertng
Copy link
Collaborator

Thanks for reporting this bug!
I opened #778 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
2 participants