In my case I embedded Python into my application. When the path of my application contains a non-latin-1 character Py_Initialize calls exit(1) internally (more information later).
So I checked if can reproduce this with the standard interpreter executable.
Python-2.7.x on Windows doesn't seem to work when the path of PYTHONHOME contains a character outside of latin-1 charset. The problem is that the module site could not be found and imported. Since umlauts seem to work, what is the actual limitation here? Is just latin-1 supported? Why does it work on OSX then?
C:\Users\ъ\Python27\python.exe // fails to start (KOI8-R)
^
C:\Users\ġ\Python27\python.exe // fails to start (latin-3)
^
C:\Users\ä\Python27\python.exe // works fine (latin-1)
^
Any ideas?
Background:
I haven't stepped through the code yet but Python 2.6 and Python 2.7 also behave differently when site is not available. Py 2.6 just prints a message, Py 2.7 rejects to start.
static void
initsite(void)
{
PyObject *m;
m = PyImport_ImportModule("site");
if (m == NULL) {
...
// Python 2.7 and later
exit(1);
// Python 2.6 and prior
PyFile_WriteString("'import site' failed; traceback:\n", f);
}
...
}
Python 2.7: https://github.com/enthought/Python-2.7.3/blob/master/Python/pythonrun.c#L725
Python 2.6: https://github.com/python-git/python/blob/master/Python/pythonrun.c#L705