LicenseCheck icon indicating copy to clipboard operation
LicenseCheck copied to clipboard

Bug: Missing Metadata of package crashes the code

Open Steenbuck opened this issue 1 year ago • 0 comments

Description

Im trying to run licensecheck -u requirements:requirements_server.txt with my requirement_file (attached requirements_server.txt the programm crashes due to errors in collection the Metadata.

licensecheck -u requirements:requirements_server.txt 

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/importlib/metadata/__init__.py", line 563, in from_name
    return next(cls.discover(name=name))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
StopIteration

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/xxx/.venv/lib/python3.11/site-packages/licensecheck/packageinfo.py", line 36, in getPackageInfoLocal
    pkgMetadata = metadata.metadata(requirement)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/importlib/metadata/__init__.py", line 998, in metadata
    return Distribution.from_name(distribution_name).metadata
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/importlib/metadata/__init__.py", line 565, in from_name
    raise PackageNotFoundError(name)
importlib.metadata.PackageNotFoundError: No package metadata was found for OUTLINES

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Users/xxx/.venv/lib/python3.11/site-packages/licensecheck/packageinfo.py", line 135, in getPackages
    packageinfo.add(getPackageInfoLocal(requirement))
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/xxx/.venv/lib/python3.11/site-packages/licensecheck/packageinfo.py", line 60, in getPackageInfoLocal
    raise ModuleNotFoundError from error
ModuleNotFoundError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/xxx/.venv/bin/licensecheck", line 8, in <module>
    sys.exit(cli())
             ^^^^^
  File "/Users/xxx/.venv/lib/python3.11/site-packages/licensecheck/cli.py", line 86, in cli
    sysexit(main(args))
            ^^^^^^^^^^
  File "/Users/xxx/.venv/lib/python3.11/site-packages/licensecheck/cli.py", line 120, in main
    myLice, depsWithLicenses = get_deps.getDepsWithLicenses(
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/xxx/.venv/lib/python3.11/site-packages/licensecheck/get_deps.py", line 232, in getDepsWithLicenses
    packages = packageinfo.getPackages(reqs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/xxx/.venv/lib/python3.11/site-packages/licensecheck/packageinfo.py", line 138, in getPackages
    packageinfo.add(getPackageInfoPypi(requirement))
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/xxx/.venv/lib/python3.11/site-packages/licensecheck/packageinfo.py", line 88, in getPackageInfoPypi
    license=ucstr(
            ^^^^^^
  File "/Users/xxx/.venv/lib/python3.11/site-packages/licensecheck/types.py", line 20, in __new__
    return super().__new__(cls, v.upper())
                                ^^^^^^^
AttributeError: 'NoneType' object has no attribute 'upper'

Expected Behavior

An output

Actual Behavior

That Error

System Information

Please provide the following additional information about your system or environment:

  • Operating System (OS): Mac
  • OS Version: Sonoma 14.0
  • Python 3.11

Steenbuck avatar Apr 25 '24 15:04 Steenbuck