From 789f65e789951a45a9eae6b51e21c7310082fab1 Mon Sep 17 00:00:00 2001 From: lilacs Date: Mon, 4 Apr 2022 20:19:05 +0900 Subject: [PATCH] Fix encoding for Windows pip. Problem : With the created package, `pip install` fails on Windows Fixes : Clarified the encoding for file reading. --- setup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 08963c6..6324c18 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ # note: all settings are in settings.ini; edit there, not here config = ConfigParser(delimiters=['=']) -config.read('settings.ini') +config.read('settings.ini', encoding='utf-8') cfg = config['DEFAULT'] cfg_keys = 'version description keywords author author_email'.split() @@ -36,7 +36,7 @@ if cfg.get('pip_requirements'): requirements += cfg.get('pip_requirements','').split() dev_requirements = (cfg.get('dev_requirements') or '').split() -long_description = open('README.md').read() +long_description = open('README.md', encoding="utf-8").read() # ![png](docs/images/output_13_0.png) for ext in ['png', 'svg']: long_description = re.sub(r'!\['+ext+'\]\((.*)\)', '!['+ext+']('+'https://raw.githubusercontent.com/{}/{}'.format(cfg['user'],cfg['lib_name'])+'/'+cfg['branch']+'/\\1)', long_description)