From 28c7b5d35c1ce3d62dfdd1c411c9aac8d3fcbcb4 Mon Sep 17 00:00:00 2001 From: Quentin Comte-Gaz Date: Fri, 4 Oct 2019 20:42:42 +0200 Subject: [PATCH] Setup: Prevent encoding issue while installing package Python opens files using the encoding returned by locale.getpreferredencoding(), which is 'cp1252' in Windows. For cross-platform compatibility, it is needed to explicitly specify 'utf-8' when reading files. File is also opened in read-only since it is not necessary to have write access to README and LICENCE files during install. --- setup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 1307356..eb40127 100644 --- a/setup.py +++ b/setup.py @@ -2,8 +2,8 @@ import sys, os here = os.path.abspath(os.path.dirname(__file__)) -README = open(os.path.join(here, 'README.rst')).read() -NEWS = open(os.path.join(here, 'NEWS.txt')).read() +README = open(os.path.join(here, 'README.rst'), 'r', encoding='utf-8').read() +NEWS = open(os.path.join(here, 'NEWS.txt'), 'r', encoding='utf-8').read() version = '0.1.dev'