Closed asergeant01 closed 4 years ago
That's strange, it's definitely been tested on 3.6.
I'm not seeing anything in the readme which might be causing a unicode issue. How are you installing it?
Same here. Can be reproduced with the official Ubuntu 18.04 Docker image:
# docker run --rm -it ubuntu:bionic bash
root@549c2d1cb3f0:/# rm -rf /tmp/venv && python3 -m venv /tmp/venv && /tmp/venv/bin/pip install -U pip && /tmp/venv/bin/pip install django-log-request-id
Collecting pip
Downloading https://files.pythonhosted.org/packages/00/b6/9cfa56b4081ad13874b0c6f96af8ce16cfbc1cb06bedf8e9164ce5551ec1/pip-19.3.1-py2.py3-none-any.whl (1.4MB)
100% |################################| 1.4MB 789kB/s
Installing collected packages: pip
Found existing installation: pip 9.0.1
Uninstalling pip-9.0.1:
Successfully uninstalled pip-9.0.1
Successfully installed pip-19.3.1
Collecting django-log-request-id
Downloading https://files.pythonhosted.org/packages/17/2f/d283eacfc9a149f65298eb0a4eec6d85a9589e15e9f11468f69ab183a250/django-log-request-id-1.4.0.tar.gz
ERROR: Command errored out with exit status 1:
command: /tmp/venv/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-482a7oif/django-log-request-id/setup.py'"'"'; __file__='"'"'/tmp/pip-install-482a7oif/django-log-request-id/setup.py'"
'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-482a7oif/django-log-reques
t-id/pip-egg-info
cwd: /tmp/pip-install-482a7oif/django-log-request-id/
Complete output (7 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-482a7oif/django-log-request-id/setup.py", line 23, in <module>
readme = f.read()
File "/usr/lib/python3.6/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 5406: ordinal not in range(128)
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
root@549c2d1cb3f0:/# python3 --version
Python 3.6.9
root@549c2d1cb3f0:/# /tmp/venv/bin/pip --version
pip 19.3.1 from /tmp/venv/lib/python3.6/site-packages/pip (python 3.6)
As the traceback tells, reading the README.md
fails with a unicode error.
If you check position 5406 in the README.md
, it is the "©" character which is obviously not part of the ASCII charset.
A simple fix could be:
diff --git a/setup.py b/setup.py
index d5d0604..16e8176 100755
--- a/setup.py
+++ b/setup.py
@@ -19,7 +19,7 @@ author_email = 'hello@dabapps.com'
license = 'BSD'
install_requires = ["django>=1.8"]
-with open('README.md') as f:
+with open('README.md', encoding='utf-8') as f:
readme = f.read()
however, the encoding
keyword argument is Python3 only, if that matters for the project.
Another simple approach would be to just remove the copyright sign which is redundant anyway.
I can definitely reproduce it like that now!
Looks like the issue is around the default encoding of files. Looks like Python is defaulting to an odd encoding by default. The docker container wants ANSI_X3.4-1968
, whereas my local machine wants UTF-8
. I suspect there's some weird locale defaulting going on.
I think I agree with your suggestion of changing the default encoding when reading to explicitly note utf-8
. The codecs
module provides a version of open
which takes an explicit encoding
argument, which should work here.
Issue installing with pip on python 3.6.