diff options
-rwxr-xr-x | bin/chpathtool.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/bin/chpathtool.py b/bin/chpathtool.py index 64606623a..6ddf329e8 100755 --- a/bin/chpathtool.py +++ b/bin/chpathtool.py @@ -51,9 +51,12 @@ class IsTextFile(object): return self._call(filename) def _is_text_magic(self, filename): - mime_type = self._m.file(filename) - if isinstance(mime_type, bytes): - mime_type = mime_type.decode('ascii', 'replace') + # regression in sys-apps/file causes + # py 3.2 & 3.3 magic module to not handle bytes properly + if isinstance(filename, bytes): + mime_type = self._m.file(str(filename)) + else: + mime_type = self._m.file(filename) return mime_type.startswith('text/') def _is_text_encoding(self, filename): |