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

AttributeError: 'EntryPoints' object has no attribute 'get' raised when using flake8 with Python 3.12 #1885

Closed
ehogan opened this issue Nov 7, 2023 · 1 comment

Comments

@ehogan
Copy link

ehogan commented Nov 7, 2023

how did you install flake8?

$ conda create --name test-flake8 python=3.12 flake8

unmodified output of flake8 --bug-report

Traceback (most recent call last):
  File "/conda/envs/test-flake8/bin/flake8", line 10, in <module>
    sys.exit(main())
             ^^^^^^
  File "/conda/envs/test-flake8/lib/python3.12/site-packages/flake8/main/cli.py", line 22, in main
    app.run(argv)
  File "/conda/envs/test-flake8/lib/python3.12/site-packages/flake8/main/application.py", line 375, in run
    self._run(argv)
  File "/conda/envs/test-flake8/lib/python3.12/site-packages/flake8/main/application.py", line 363, in _run
    self.initialize(argv)
  File "/conda/envs/test-flake8/lib/python3.12/site-packages/flake8/main/application.py", line 343, in initialize
    self.find_plugins(config_finder)
  File "/conda/envs/test-flake8/lib/python3.12/site-packages/flake8/main/application.py", line 157, in find_plugins
    self.check_plugins = plugin_manager.Checkers(local_plugins.extension)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/conda/envs/test-flake8/lib/python3.12/site-packages/flake8/plugins/manager.py", line 363, in __init__
    self.manager = PluginManager(
                   ^^^^^^^^^^^^^^
  File "/conda/envs/test-flake8/lib/python3.12/site-packages/flake8/plugins/manager.py", line 243, in __init__
    self._load_entrypoint_plugins()
  File "/conda/envs/test-flake8/lib/python3.12/site-packages/flake8/plugins/manager.py", line 261, in _load_entrypoint_plugins
    eps = importlib_metadata.entry_points().get(self.namespace, ())
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'EntryPoints' object has no attribute 'get'

describe the problem

what I expected to happen

When I run any flake8 command using the version of flake8 from the Conda environment (created as above) I get the same traceback (provided above and below).

I do not see this problem if I specify python=3.11 when creating the Conda environment.

commands ran

$ flake8 --help
Traceback (most recent call last):
  File "/conda/envs/test-flake8/bin/flake8", line 10, in <module>
    sys.exit(main())
             ^^^^^^
  File "/conda/envs/test-flake8/lib/python3.12/site-packages/flake8/main/cli.py", line 22, in main
    app.run(argv)
  File "/conda/envs/test-flake8/lib/python3.12/site-packages/flake8/main/application.py", line 375, in run
    self._run(argv)
  File "/conda/envs/test-flake8/lib/python3.12/site-packages/flake8/main/application.py", line 363, in _run
    self.initialize(argv)
  File "/conda/envs/test-flake8/lib/python3.12/site-packages/flake8/main/application.py", line 343, in initialize
    self.find_plugins(config_finder)
  File "/conda/envs/test-flake8/lib/python3.12/site-packages/flake8/main/application.py", line 157, in find_plugins
    self.check_plugins = plugin_manager.Checkers(local_plugins.extension)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/conda/envs/test-flake8/lib/python3.12/site-packages/flake8/plugins/manager.py", line 363, in __init__
    self.manager = PluginManager(
                   ^^^^^^^^^^^^^^
  File "/conda/envs/test-flake8/lib/python3.12/site-packages/flake8/plugins/manager.py", line 243, in __init__
    self._load_entrypoint_plugins()
  File "/conda/envs/test-flake8/lib/python3.12/site-packages/flake8/plugins/manager.py", line 261, in _load_entrypoint_plugins
    eps = importlib_metadata.entry_points().get(self.namespace, ())
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'EntryPoints' object has no attribute 'get'

Thank you! :)

@asottile
Copy link
Member

asottile commented Nov 7, 2023

you are using a very old version of flake8 -- please search the issue tracker next time there are several duplicates and resolutions

@asottile asottile closed this as completed Nov 7, 2023
@PyCQA PyCQA locked as off-topic and limited conversation to collaborators Nov 7, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants