[issue30338] LC_ALL=en_US + io.open() => LookupError: (osx)

STINNER Victor report at bugs.python.org
Fri May 12 06:12:16 EDT 2017


STINNER Victor added the comment:

Thanks for your bug report Anthony Sottile! It's now fixed!


My backport was merged.

New changeset 94a3694c3dda97e3bcb51264bf47d948c5424d84 by Victor Stinner in branch '2.7':
bpo-6393: Fix locale.getprerredencoding() on macOS (#1555)
https://github.com/python/cpython/commit/94a3694c3dda97e3bcb51264bf47d948c5424d84

Before, without the fix:

macbook:2.7 haypo$ LANG=en_US ./python.exe -c 'import io; print(io.open("setup.py").encoding)'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
LookupError: unknown encoding: 


After, with the fix:

macbook:2.7 haypo$ LANG=en_US ./python.exe -c 'import io; print(io.open("setup.py").encoding)'
UTF-8


--

Python 3.7 is not affected:

macbook:master haypo$ LANG=en_US ./python.exe -c 'import locale; print(locale.getpreferredencoding())'
UTF-8

macbook:master haypo$ LANG=en_US ./python.exe -c 'import io; print(io.open("setup.py").encoding)'
UTF-8

----------
resolution:  -> fixed
stage:  -> resolved
status: open -> closed
versions:  -Python 3.6

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue30338>
_______________________________________


More information about the Python-bugs-list mailing list