Installation fails on Chinese version of Windows
Closed this issue · 5 comments
On a Chinese version of Windows, installation fails with the following error:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\h8621\AppData\Local\Temp\pip-install-pddygxyk\wilson\setup.py", line 7, in <module>
LONG_DESCRIPTION = f.read()
UnicodeDecodeError: 'gbk' codec can't decode byte 0x93 in position 272: illegal multibyte sequence
It looks like the problem is caused by setup.py
reading the file README.md
, which is utf-8 encoded. In particular, the en dash at position 272 of that file is a multibyte character that is not properly decoded. I assume that this problem can be fixed by explicitly specifying the file encoding when opening the file, i.e. by changing line 6 of setup.py
to
with open("README.md", encoding="utf-8") as f:
I asked the person reporting that problem to test if my proposed solution solves the problem.
Wow, this comes as a shock to me, Python does not use UTF-8 by default for open
😮
It probably uses the default encoding of the operating system, which on (at least some) Chinese versions of Windows seems to be GBK instead of UTF-8 (https://en.wikipedia.org/wiki/GBK_(character_encoding))
The person who has reported the problem has downloaded the wilson
source, modified setup.py
as suggested, and was able to install the package. I have implemented this modification in PR #48.
Fixed by #48.