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

Improve error message in case a requirement is not installed. #89

Open
danschef opened this issue Sep 6, 2022 · 0 comments
Open

Improve error message in case a requirement is not installed. #89

danschef opened this issue Sep 6, 2022 · 0 comments

Comments

@danschef
Copy link

danschef commented Sep 6, 2022

In case a requirement found in the requirements.txt is not installed in the current environment, liccheck fails with an AttributeError like this:

(myenv) me@geoms:~$ liccheck --no-deps
gathering licenses...
Traceback (most recent call last):
  File "/home/me/mambaforge/envs/myenv/bin/liccheck", line 8, in <module>
    sys.exit(main())
  File "/home/me/mambaforge/envs/myenv/lib/python3.10/site-packages/liccheck/command_line.py", line 399, in main
    sys.exit(run(args))
  File "/home/me/mambaforge/envs/myenv/lib/python3.10/site-packages/liccheck/command_line.py", line 388, in run
    return process(args['requirement_txt_file'], strategy, args['level'], args['reporting_txt_file'],
  File "/home/me/mambaforge/envs/myenv/lib/python3.10/site-packages/liccheck/command_line.py", line 250, in process
    pkg_info = get_packages_info(requirement_file, no_deps)
  File "/home/me/mambaforge/envs/myenv/lib/python3.10/site-packages/liccheck/command_line.py", line 166, in get_packages_info
    packages = [transform(dist) for dist in resolve_func(requirements)]
  File "/home/me/mambaforge/envs/myenv/lib/python3.10/site-packages/liccheck/command_line.py", line 166, in <listcomp>
    packages = [transform(dist) for dist in resolve_func(requirements)]
  File "/home/me/mambaforge/envs/myenv/lib/python3.10/site-packages/liccheck/command_line.py", line 120, in transform
    licenses = get_licenses_from_classifiers(dist) or get_license(dist) or []
  File "/home/me/mambaforge/envs/myenv/lib/python3.10/site-packages/liccheck/command_line.py", line 146, in get_licenses_from_classifiers
    if dist.has_metadata(dist.PKG_INFO):
AttributeError: 'NoneType' object has no attribute 'has_metadata'

It would be nice to have a more useful error message.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant