[issue33611] Fatal Python error: Py_Initialize: unable to load the file system codec

INADA Naoki report at bugs.python.org
Wed May 23 21:15:39 EDT 2018


INADA Naoki <songofacandy at gmail.com> added the comment:

> We should maybe dump sys.path into stderr on the specific "unable to load the file system codec" error.

In addition to sys.path, I think "What's current python home (prefix and exec-prefix), and where it come from" is very useful.

I recently fixed Vim's bug. https://github.com/vim/vim/pull/2787

Vim called Py_SetPythonHome with path of Python when vim is compiled.  After reinstalling Python to another directory, vim fails with "no module named encoding" error everytime.  This suffered many homebrew users because homebrew use different directory to install Python every revisions.

Python home will be come from different locations:

* Calculated from Python executable path
* Embedded in Python static/dynamic library
* PYTHONHOME environment variable
* Py_SetPythonHome()

----------

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


More information about the Python-bugs-list mailing list