Skip to content

Commit 7d9744e

Browse files
authored
Merge pull request ywangd#403 from onyxware/dev
Fix encoding error for executing setup.py
2 parents 417a414 + 19323a0 commit 7d9744e

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

bin/crypt.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ def aes_decrypt(self, key, chunksize=64 * 1024):
7474
args = ap.parse_args()
7575
crypt = Crypt(args.infile, args.outfile)
7676
if args.decrypt:
77-
crypt.aes_decrypt(args.key)
77+
crypt.aes_decrypt(args.key.encode())
7878
else:
7979
nk = crypt.aes_encrypt(args.key)
8080
if args.key is None:
81-
print("Key: %s" % nk)
81+
print("Key: %s" % nk.decode())

bin/pip.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -780,9 +780,12 @@ def _get_cooked_ast(filename):
780780
"""
781781
# with codecs.open(filename, mode="r", encoding="UTF-8") as ins:
782782
# s = ins.read()
783-
with open(filename, "r") as ins:
784-
s = ins.read()
785-
tree = ast.parse(s, filename=filename, mode='exec')
783+
with open(filename, "rb") as ins:
784+
tree = ast.parse(
785+
ins.read(),
786+
filename=filename,
787+
mode='exec'
788+
)
786789
ArchiveFileInstaller.SetupTransformer().visit(tree)
787790
return tree
788791

0 commit comments

Comments
 (0)