diff options
| author | riot <riot@hackerfleet.org> | 2016-04-07 14:39:32 +0200 |
|---|---|---|
| committer | riot <riot@hackerfleet.org> | 2016-04-07 14:39:32 +0200 |
| commit | c7873d38c4478f86864666cd1231877d1183b820 (patch) | |
| tree | 3d1d2159bd589f0f9822b230c1972cb9d06db74f /pkg_resources | |
| parent | a31716f5a86061d7409b8c08154d3b52ff324efd (diff) | |
| download | python-setuptools-git-c7873d38c4478f86864666cd1231877d1183b820.tar.gz | |
This helps finding packages with bad utf
Checking hundreds of possibly installed packages manually should NOT be expected of the user ;)
Diffstat (limited to 'pkg_resources')
| -rw-r--r-- | pkg_resources/__init__.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/pkg_resources/__init__.py b/pkg_resources/__init__.py index 08677719..8eb697f4 100644 --- a/pkg_resources/__init__.py +++ b/pkg_resources/__init__.py @@ -1859,7 +1859,10 @@ class FileMetadata(EmptyProvider): def get_metadata(self, name): if name=='PKG-INFO': with io.open(self.path, encoding='utf-8') as f: - metadata = f.read() + try: + metadata = f.read() + except UnicodeDecodeError as e: + raise Exception("Bad utf in package: %s - %s" % (self.path, e)) return metadata raise KeyError("No metadata except PKG-INFO is available") |
