Skip to content
This repository was archived by the owner on Jan 10, 2023. It is now read-only.

Commit 5b5e75b

Browse files
wannaphongmina86
authored andcommitted
Fix installation failure on Windows
Make setup.py explicitly specify encoding of files it opens. Without that, installation fails on Windows with the following error message: Collecting pygtrie Using cached pygtrie-2.1.tar.gz Complete output from command python setup.py egg_info: Traceback (most recent call last): File "<string>", line 1, in <module> File "C:\Users\WANNAP~1\AppData\Local\Temp\pip-build-553d519x\pygtrie\setup.py", line 17, in <module> readme = f.read() File "C:\Users\wannaphong\Anaconda3\lib\encodings\cp874.py", line 23, in decode return codecs.charmap_decode(input,self.errors,decoding_table)[0] UnicodeDecodeError: 'charmap' codec can't decode byte 0x99 in position 933: character maps to <undefined> ---------------------------------------- Command "python setup.py egg_info" failed with error code 1 in C:\Users\WANNAP~1\AppData\Local\Temp\pip-build-553d519x\pygtrie\ This fixes <#16>.
1 parent 10e44c4 commit 5b5e75b

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

setup.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import os
33
import re
44
import sys
5+
import codecs
56

67
import version
78

@@ -13,9 +14,9 @@
1314
'-Dversion=' + '.'.join(release.split('.', 2)[0:2]),
1415
'.', 'html')
1516

16-
with open('README.rst') as f:
17+
with codecs.open('README.rst', 'r', 'utf-8') as f:
1718
readme = f.read()
18-
with open('version-history.rst') as f:
19+
with codecs.open('version-history.rst', 'r', 'utf-8') as f:
1920
readme += '\n' + f.read()
2021

2122
kwargs = {

0 commit comments

Comments
 (0)