tools-python
tools-python copied to clipboard
Unhashable type SpdxNoAssertion
Hi there, if any relationships contain a NOASSERTION relationship, represented by the object SpdxNoAssertion(), then there will be a failure to write to file
File "path/to/lib/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'
The current work around I found is changing the if statements in scan_relationships to the following (lines 87-89)
if (
relationship.relationship_type == RelationshipType.CONTAINS
and relationship.spdx_element_id in packages_spdx_ids
and str(relationship.related_spdx_element_id) in files_by_spdx_id.keys()
):
Alternatively for a user side fix, replace your SpdxNoAssertion with "NOASSERTION" in any relationship or str(SpdxNoAssertion())
Also, I just want to voice some disappointment in the complete lack of backwards compatibility in the 0.7.1->0.8.0 upgrade. I appreciate this very useful tool and the work the developers do, but when it takes as much time to fix my old script that was working as it would to just manually write and SPDX document by hand, it is very frustrating for me as a user. I hope you consider more backwards compatibility in future major patches. Thanks!