From 3c45fb7a99c09166c36001d442312363b436b6ac Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Sat, 8 Aug 2020 18:01:04 +0000 Subject: [PATCH] [fix] set encoding of README.rst explicit in setup.py (utf-8) (#2117) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## What does this PR do? When installing searx on a centos-7 image [1] an encoding exception is raised from setup.py:: command: /usr/local/searx/searx-pyenv/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/usr/local/searx/searx-src/setup.py'"'"'; __file__='"'"'/usr/local/searx/searx-src/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-pidntzkq cwd: /usr/local/searx/searx-src/ Complete output (7 lines): Traceback (most recent call last): File "", line 1, in File "/usr/local/searx/searx-src/setup.py", line 16, in long_description = f.read() File "/usr/lib64/python3.6/encodings/ascii.py", line 26, in decode return codecs.ascii_decode(input, self.errors)[0] UnicodeDecodeError: 'ascii' codec can't decode byte 0xc9 in position 482: ordinal not in range(128) [1] https://uk.images.linuxcontainers.org/ ## Why is this change important? README.rst uses non ASCII characters _(pronunciation səːks.)_ ## How to test this PR locally? install searx on a centos-7 image from https://uk.images.linuxcontainers.org/ --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 97a3270e..6a78f61b 100644 --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ sys.path.insert(0, './searx') from version import VERSION_STRING import brand -with open('README.rst') as f: +with open('README.rst', encoding='utf-8') as f: long_description = f.read() with open('requirements.txt') as f: