41 lines
1.2 KiB
Diff
41 lines
1.2 KiB
Diff
From e636f6d9dc531890cd8415f077ad93dbb35c6ad8 Mon Sep 17 00:00:00 2001
|
|
From: AndCycle <andcycle-github@andcycle.idv.tw>
|
|
Date: Tue, 3 May 2016 23:57:33 +0800
|
|
Subject: [PATCH] fix for UnicodeDecodeError: 'ascii' codec can't decode byte
|
|
0xe2 in position 208687: ordinal not in range(128) #105
|
|
|
|
---
|
|
setup.py | 5 +++--
|
|
1 file changed, 3 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/setup.py b/setup.py
|
|
index b39303a..28a9623 100755
|
|
--- a/setup.py
|
|
+++ b/setup.py
|
|
@@ -4,6 +4,7 @@
|
|
import os
|
|
import re
|
|
import sys
|
|
+from io import open
|
|
|
|
try:
|
|
from setuptools import setup, Command
|
|
@@ -22,7 +23,7 @@ def _read_doc():
|
|
Parse docstring from file 'pefile.py' and avoid importing
|
|
this module directly.
|
|
"""
|
|
- with open('pefile.py', 'r') as f:
|
|
+ with open('pefile.py', 'r', encoding='utf-8') as f:
|
|
tree = ast.parse(f.read())
|
|
return ast.get_docstring(tree)
|
|
|
|
@@ -35,7 +36,7 @@ def _read_attr(attr_name):
|
|
__version__, __author__, __contact__,
|
|
"""
|
|
regex = attr_name + r"\s+=\s+'(.+)'"
|
|
- with open('pefile.py', 'r') as f:
|
|
+ with open('pefile.py', 'r', encoding='utf-8') as f:
|
|
match = re.search(regex, f.read())
|
|
# Second item in the group is the value of attribute.
|
|
return match.group(1)
|