Closed as duplicate of#91992
Closed as duplicate of#91992
Description
Crash report
What happened?
Python aborts when it is started in the IBM-943 (Japanese shift_jis) locale.
I hope python will support IBM-943.
Even if that is not achieved, is it possible to have python change its behavior to fall back to LANG=C instead of aborting when it encounters a character locale that python does not recognize? (like perl)
[root:/]# uname -a
AIX testhost 2 7 00FA9C234B00
[root:/]# oslevel -s
7200-05-06-2320
[root:/]# echo $LANG
Ja_JP
[root:/]# locale
LANG=Ja_JP
LC_COLLATE="Ja_JP"
LC_CTYPE="Ja_JP"
LC_MONETARY="Ja_JP"
LC_NUMERIC="Ja_JP"
LC_TIME="Ja_JP"
LC_MESSAGES="Ja_JP"
LC_ALL=
[root:/]# which python3
/usr/bin/python3
[root:/]# /usr/bin/python3 -VV
Python 3.9.6 (default, Sep 30 2021, 15:30:58)
[GCC 8.3.0]
[root:/]# /usr/bin/python3
Python path configuration:
PYTHONHOME = (not set)
PYTHONPATH = (not set)
program name = '/usr/bin/python3'
isolated = 0
environment = 1
user site = 1
import site = 1
sys._base_executable = '/usr/bin/python3'
sys.base_prefix = '/opt/freeware'
sys.base_exec_prefix = '/opt/freeware'
sys.platlibdir = 'lib64'
sys.executable = '/usr/bin/python3'
sys.prefix = '/opt/freeware'
sys.exec_prefix = '/opt/freeware'
sys.path = [
'/opt/freeware/lib64/python39.zip',
'/opt/freeware/lib64/python3.9',
'/opt/freeware/lib64/python3.9/lib-dynload',
]
Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
Python runtime state: core initialized
LookupError: unknown encoding: IBM-943
Current thread 0x0000000000000001 (most recent call first):
<no Python frame>
[root:/]#
[root:/]# /usr/bin/python3 -vvv
import _frozen_importlib # frozen
import _imp # builtin
import '_thread' # <class '_frozen_importlib.BuiltinImporter'>
import '_warnings' # <class '_frozen_importlib.BuiltinImporter'>
import '_weakref' # <class '_frozen_importlib.BuiltinImporter'>
import '_io' # <class '_frozen_importlib.BuiltinImporter'>
import 'marshal' # <class '_frozen_importlib.BuiltinImporter'>
import 'posix' # <class '_frozen_importlib.BuiltinImporter'>
import '_frozen_importlib_external' # <class '_frozen_importlib.FrozenImporter'>
# installing zipimport hook
import 'time' # <class '_frozen_importlib.BuiltinImporter'>
import 'zipimport' # <class '_frozen_importlib.FrozenImporter'>
# installed zipimport hook
# /opt/freeware/lib64/python3.9/encodings/__pycache__/__init__.cpython-39.pyc matches /opt/freeware/lib64/python3.9/encodings/__init__.py
# code object from '/opt/freeware/lib64/python3.9/encodings/__pycache__/__init__.cpython-39.pyc'
# trying /opt/freeware/lib64/python3.9/codecs.cpython-39.so
# trying /opt/freeware/lib64/python3.9/codecs.abi3.so
# trying /opt/freeware/lib64/python3.9/codecs.so
# trying /opt/freeware/lib64/python3.9/codecs.py
# /opt/freeware/lib64/python3.9/__pycache__/codecs.cpython-39.pyc matches /opt/freeware/lib64/python3.9/codecs.py
# code object from '/opt/freeware/lib64/python3.9/__pycache__/codecs.cpython-39.pyc'
import '_codecs' # <class '_frozen_importlib.BuiltinImporter'>
import 'codecs' # <_frozen_importlib_external.SourceFileLoader object at 0xa000000000aff40>
# trying /opt/freeware/lib64/python3.9/encodings/aliases.cpython-39.so
# trying /opt/freeware/lib64/python3.9/encodings/aliases.abi3.so
# trying /opt/freeware/lib64/python3.9/encodings/aliases.so
# trying /opt/freeware/lib64/python3.9/encodings/aliases.py
# /opt/freeware/lib64/python3.9/encodings/__pycache__/aliases.cpython-39.pyc matches /opt/freeware/lib64/python3.9/encodings/aliases.py
# code object from '/opt/freeware/lib64/python3.9/encodings/__pycache__/aliases.cpython-39.pyc'
import 'encodings.aliases' # <_frozen_importlib_external.SourceFileLoader object at 0xa000000000d3610>
import 'encodings' # <_frozen_importlib_external.SourceFileLoader object at 0xa000000000afe50>
# trying /opt/freeware/lib64/python3.9/encodings/ibm_943.cpython-39.so
# trying /opt/freeware/lib64/python3.9/encodings/ibm_943.abi3.so
# trying /opt/freeware/lib64/python3.9/encodings/ibm_943.so
# trying /opt/freeware/lib64/python3.9/encodings/ibm_943.py
# trying /opt/freeware/lib64/python3.9/encodings/ibm_943.pyc
Python path configuration:
PYTHONHOME = (not set)
PYTHONPATH = (not set)
program name = '/usr/bin/python3'
isolated = 0
environment = 1
user site = 1
import site = 1
sys._base_executable = '/usr/bin/python3'
sys.base_prefix = '/opt/freeware'
sys.base_exec_prefix = '/opt/freeware'
sys.platlibdir = 'lib64'
sys.executable = '/usr/bin/python3'
sys.prefix = '/opt/freeware'
sys.exec_prefix = '/opt/freeware'
sys.path = [
'/opt/freeware/lib64/python39.zip',
'/opt/freeware/lib64/python3.9',
'/opt/freeware/lib64/python3.9/lib-dynload',
]
Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
Python runtime state: core initialized
LookupError: unknown encoding: IBM-943
Current thread 0x0000000000000001 (most recent call first):
<no Python frame>
[root:/]#
[root:/]#
CPython versions tested on:
3.9
Operating systems tested on:
Other
Output from running 'python -VV' on the command line:
Python 3.9.6 (default, Sep 30 2021, 15:30:58) [GCC 8.3.0]