[issue38236] Dump the Python path configuration at the first import error

STINNER Victor report at bugs.python.org
Mon Sep 23 10:01:26 EDT 2019


STINNER Victor <vstinner at python.org> added the comment:

I backported my change to Python 3.8.

Example with PYTHONPATH set to Python 2.7 with Python 3.8:

$ PYTHONPATH=/usr/lib64/python2.7/ ./python -c pass
Python path configuration:
  PYTHONHOME = (not set)
  PYTHONPATH = '/usr/lib64/python2.7/'
  program name = './python'
  isolated = 0
  environment = 1
  user site = 1
  import site = 1
  sys._base_executable = '/home/vstinner/python/3.8/python'
  sys.base_prefix = '/usr/local'
  sys.base_exec_prefix = '/usr/local'
  sys.executable = '/home/vstinner/python/3.8/python'
  sys.prefix = '/usr/local'
  sys.exec_prefix = '/usr/local'
  sys.path = [
    '/usr/lib64/python2.7/',
    '/usr/local/lib/python38.zip',
    '/home/vstinner/python/3.8/Lib',
    '/home/vstinner/python/3.8/build/lib.linux-x86_64-3.8-pydebug',
  ]
Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
Python runtime state: core initialized
  File "/usr/lib64/python2.7/encodings/__init__.py", line 123
    raise CodecRegistryError,\
                            ^
SyntaxError: invalid syntax

Current thread 0x00007fe3ade4d740 (most recent call first):
<no Python frame>

----------
versions: +Python 3.8

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue38236>
_______________________________________


More information about the Python-bugs-list mailing list