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

STINNER Victor report at bugs.python.org
Wed May 10 19:11:56 EDT 2017


STINNER Victor added the comment:

> It may be an OSX specific bug?

Yes, on Linux, it "just works":

haypo at selma$ LC_ALL=en_US python2 -c 'import io; io.open("/dev/null")'
haypo at selma$ LC_ALL=en_USxxx python2 -c 'import io; io.open("/dev/null")'

In fact, you get ASCII encoding for these two locales:

haypo at selma$ LC_ALL=en_US python2 -c 'import locale; print(locale.getpreferredencoding(False))'
ANSI_X3.4-1968

haypo at selma$ LC_ALL=en_USxxx python2 -c 'import locale; print(locale.getpreferredencoding(False))'
ANSI_X3.4-1968

Internally, io.open() uses locale.getpreferredencoding(False) if you don't specify an encoding.

----------
nosy: +haypo

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


More information about the Python-bugs-list mailing list