Bug: packages without PyPI Classifiers can't be properly parsed
RaczeQ opened this issue · 1 comments
RaczeQ commented
Bug
- I have read the comment above and have completed each step
- I have filled out the system info
- I have described the bug, filled in the expected outcome and the actual
outcome including screenshots where appropriate
System info
- OS: Ubuntu
- Version: 20.04
Describe the bug
Trying to analyse a package that doesn't have any Classifiers on a PyPI results in an error.
Example packages:
https://pypi.org/project/kaleido/
https://pypi.org/project/jsbeautifier/
Error:
Traceback (most recent call last):
File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
exec(code, run_globals)
File ".../.venv/lib/python3.8/site-packages/licensecheck/__main__.py", line 6, in <module>
cli()
File ".../.venv/lib/python3.8/site-packages/licensecheck/__init__.py", line 90, in cli
depsWithLicenses = get_deps.getDepsWithLicenses(
File ".../.venv/lib/python3.8/site-packages/licensecheck/get_deps.py", line 116, in getDepsWithLicenses
packages = packageinfo.getPackages(reqs)
File ".../.venv/lib/python3.8/site-packages/licensecheck/packageinfo.py", line 122, in getPackages
packageinfo.add(getPackageInfoLocal(requirement))
File ".../.venv/lib/python3.8/site-packages/licensecheck/packageinfo.py", line 34, in getPackageInfoLocal
lice = licenseFromClassifierlist(pkgMetadata.get_all("Classifier"))
File ".../.venv/lib/python3.8/site-packages/licensecheck/packageinfo.py", line 102, in licenseFromClassifierlist
for val in classifiers:
TypeError: 'NoneType' object is not iterable
Expected outcome
When the package has no classifiers, return UNKNOWN
license.
Actual outcome
When the package has no classifiers, the error is thrown since the code expects classifierList to be a list.