-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
problems with LC_ALL=C #761
Comments
It seems the first point, the issue on setup.py, is solved by @qwcode. But the second point of |
For the record: I gave up on this :) I don't know how to make reliably installable packages with non-ascii metadata under Python 2.x. As for the first point, I think the commited solution is fragile (because non-ascii chars could accidently be introduced again) and it is better to explicitly decode news.txt from ascii to prevent such errors in future. |
Also, I think pip should have Travis/tox environment with LC_ALL=C to test against this. |
Same here:
|
cc @pauleveritt |
Indeed, this was the source of my problem. In one shell I had this in my environment: LANG=en_US.UTF-8 ...and pip worked. In another shell I didn't, and got the UnicodeDecodeError exception. |
With that, building and uploading wheels to PyPI is only one "python setup.py bdist_wheel" away. Also, changes LC_ALL from C to UTF-8 to get around a bug in pip: pypa/pip#761 Change-Id: I508ab6436c29b23f6b8d56c0ec63eb26f3568819
Hi there, This issue seems to still be running; the way I see it, there seems to be two options:
It seems that fixing the manually written micro-scripts around lines 600 and 285, as well as I'd like to contribute a patch to fix this issue; which option would you prefer? |
Is this still a thing? |
@pradyunsg I haven't face this in recent times. I saw this before though. This might not be existing anymore. But in the face of ambiguity, refuse the temptation to guess. |
Can anyone tell me how to reproduce this(if it's still a bug)? The initial comment seems to be referring to the older piece of code and I really am not able to understand much out ot it. Though if it's not present, we can then close it. :) |
I believe this part of the code base has been removed. pip now uses distlib to read legacy metadata (egg-info), which always uses UTF-8. |
In that case, let's close this! :) |
There is a pattern of using
open(path, 'r').read()
without explicit encoding in pip:This pattern causes issues under Python 3.x with ASCII locale because file contents is decoded using ascii in this case and it fails for non-ascii data.
The first occurance (in setup.py) is clearly wrong IMHO: the utility function is used for reading pip's own index.txt and news.txt files which are encoded to utf8. It may cause the following exception:
if the following is added to pip's own tox.ini:
The second is more tricky and I didn't debug it. It causes the following exception:
in https://github.com/kmike/DAWG testing suite (https://github.com/kmike/DAWG/blob/master/tox.ini).
DAWG package has a non-ascii README.rst (which is loaded to long_description, binary under Python 2.x and unicode under Python 3.x).
Under Python 2.x this works fine because req.py doesn't try to decode the data.
The text was updated successfully, but these errors were encountered: