1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
Index: pattern-820cccf33c6ac4a4f1564a273137171cfa6ab7cb/pattern/text/__init__.py
===================================================================
--- pattern-820cccf33c6ac4a4f1564a273137171cfa6ab7cb.orig/pattern/text/__init__.py
+++ pattern-820cccf33c6ac4a4f1564a273137171cfa6ab7cb/pattern/text/__init__.py
@@ -305,7 +305,11 @@ def _read(path, encoding="utf-8", commen
strippping comments and decoding each line to Unicode.
"""
if path:
- if isinstance(path, basestring) and os.path.exists(path):
+ try:
+ from_file_path = isinstance(path, basestring) and os.path.exists(path)
+ except UnicodeEncodeError:
+ from_file_path = isinstance(path, basestring) and os.path.exists(encode_utf8(path))
+ if from_file_path:
# From file path.
f = open(path, "rb")
elif isinstance(path, basestring):
|