Fail reading package-infos with unexpected encodings

Bug #1780454 reported by ankostis
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
pkginfo
Fix Released
Undecided
Unassigned

Bug Description

Since the `PKG-INFO` file etc frequently contain the full README.rst,
it happens that strange characters are contained.

Unfortunately, packaging-tools do not check encoding-validity of chars.
So it is unpleasent when later `pkginfo` cannot extract metadata.

Roughlt the following (hand-made) patch would suffice:

```diff

--- a/pkginfo/develop.py
+++ b/pkginfo/develop.py
@@ -0,2 +0,3 @@
+import io
 import os
 import sys

@@ -41,3 +41,3 @@
             if os.path.exists(path):
- with open(path) as f:
+ with io.open(path, errors='ignore') as f:
                     return f.read()

```

Respective fixes needed in all other modules (e.g. `pkginfo.installed.py`).

Revision history for this message
Tres Seaver (tseaver) wrote :
Changed in pkginfo:
status: New → Fix Committed
Revision history for this message
Tres Seaver (tseaver) wrote :

@ankostis Thanks for the report, and the suggested fix!

Tres Seaver (tseaver)
Changed in pkginfo:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.