close
Skip to content

FastPath can raise UnicodeDecodeErrors on py2 #121

Description

@jaraco

In GitLab by @tburke on May 13, 2020, 07:35

importlib-metadata 1.6.0, python 2.7.17

With a directory named ☃ (b'\xe2\x98\x83') in my current directory, I'd hit tracebacks ending like

  File ".../python2.7/site-packages/importlib_metadata/__init__.py", line 575, in entry_points
    ordered = sorted(eps, key=by_group)
  File ".../python2.7/site-packages/importlib_metadata/__init__.py", line 573, in <genexpr>
    dist.entry_points for dist in distributions())
  File ".../python2.7/site-packages/importlib_metadata/__init__.py", line 455, in search
    or n_low.startswith(name.prefix)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 0: ordinal not in range(128)

when running flake8 for a project. Things work if I remove the directory (it was just for testing), but it'd be better to not have to do that.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Fields

    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