Skip to content

Python module names which conflict with first party module names break flake8 #596

Description

@w0rp

If a Python module matches a module name used internally by flake8, then flake8 will stop reporting errors with no indication of what is wrong.

For example, if you create a file called email.py, you will receive the following error in stderr:

Traceback (most recent call last):
  File "/home/w0rp/ve/bin/flake8", line 7, in <module>
    from flake8.main.cli import main
  File "/home/w0rp/ve/local/lib/python2.7/site-packages/flake8/main/cli.py", line 2, in <module>
    from flake8.main import application
  File "/home/w0rp/ve/local/lib/python2.7/site-packages/flake8/main/application.py", line 17, in <module>
    from flake8.plugins import manager as plugin_manager
  File "/home/w0rp/ve/local/lib/python2.7/site-packages/flake8/plugins/manager.py", line 5, in <module>
    import pkg_resources
  File "/home/w0rp/ve/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 35, in <module>
    import email.parser
...
ImportError: cannot import name charset

I'm not sure whether to report this as a flake8 bug or not. I think ALE should try and give you some indication on what is wrong. Maybe ALE can just look at both stdout and stderr, look for an ImportError line, and then present a short message telling you to check the module name, with the full trackback in .detail.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions