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

Bug: packages without PyPI Classifiers can't be properly parsed #28

Closed
3 tasks done
RaczeQ opened this issue Jan 20, 2023 · 1 comment
Closed
3 tasks done

Bug: packages without PyPI Classifiers can't be properly parsed #28

RaczeQ opened this issue Jan 20, 2023 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@RaczeQ
Copy link
Contributor

RaczeQ commented Jan 20, 2023

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.

@RaczeQ RaczeQ added the bug Something isn't working label Jan 20, 2023
@RaczeQ
Copy link
Contributor Author

RaczeQ commented Jan 23, 2023

Closing this one, since #30 has been merged.

@RaczeQ RaczeQ closed this as completed Jan 23, 2023
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

2 participants