Skip to content

Error on Ubuntu with Python 3.7 #229

@ajyoon

Description

@ajyoon

I recently changed my project's CI from using Python 3.10 to 3.7 and unimport started failing with this error:

Traceback (most recent call last):
  File "/home/runner/work/neoscore/neoscore/.venv/bin/unimport", line 8, in <module>
    sys.exit(main())
  File "/home/runner/work/neoscore/neoscore/.venv/lib/python3.7/site-packages/unimport/main.py", line 60, in main
    utils.get_used_packages(Import.imports, unused_imports)
  File "/home/runner/work/neoscore/neoscore/.venv/lib/python3.7/site-packages/unimport/utils.py", line 102, in get_used_packages
    name = package_name_from_metadata(package)
  File "/home/runner/work/neoscore/neoscore/.venv/lib/python3.7/site-packages/unimport/utils.py", line 90, in package_name_from_metadata
    return metadata(package)["Name"]
  File "/home/runner/work/neoscore/neoscore/.venv/lib/python3.7/site-packages/importlib_metadata/__init__.py", line 1005, in metadata
    return Distribution.from_name(distribution_name).metadata
  File "/home/runner/work/neoscore/neoscore/.venv/lib/python3.7/site-packages/importlib_metadata/__init__.py", line 562, in from_name
    raise ValueError("A distribution name is required.")
ValueError: A distribution name is required.

I can't reproduce this on my local machine (Arch Linux with Python 3.7.13), but you can see detailed environment info on the build here.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingchangelogChanges should be written to the changelog file.

Projects

Status

✅ Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions