[Python-bugs-list] [ python-Bugs-668708 ] Py_NewInterpreter() doesn't work
SourceForge.net
noreply@sourceforge.net
Mon, 20 Jan 2003 14:58:43 -0800
Bugs item #668708, was opened at 2003-01-15 12:17
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=668708&group_id=5470
Category: None
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Geert Jansen (geertj)
Assigned to: Nobody/Anonymous (nobody)
Summary: Py_NewInterpreter() doesn't work
Initial Comment:
Hello,
mod_python doesn't seem to work with Python 2.3a1.
After some debugging, it seems the culprit is
Py_NewInterpreter(). The following C program works with
Python 2.2 but gives an error with Python 2.3:
#include <Python.h>
int main()
{
PyThreadState *tstate;
Py_Initialize();
tstate = Py_NewInterpreter();
return 0;
}
The relevant part of this program's output:
geertj@cristina:~$ PYTHONVERBOSE=1 ./a.out
# installing zipimport hook
import zipimport # builtin
[...]
import __builtin__ # previously loaded (__builtin__)
import sys # previously loaded (sys)
'import site' failed; traceback:
ImportError: No module named site
It seems that Python is unable to find the module "site".
Greetings,
Geert Jansen
----------------------------------------------------------------------
Comment By: Josh Hoyt (joshhoyt)
Date: 2003-01-20 14:58
Message:
Logged In: YES
user_id=693077
The problem appears to be that meta_path is not being
initialized in the new interpreter. Adding
_PyImportHooks_Init to Py_NewInterpreter seems to fix the
problem, initializing the new import hooks before trying to
import modules into the new interpreter.
----------------------------------------------------------------------
Comment By: Geert Jansen (geertj)
Date: 2003-01-15 12:19
Message:
Logged In: YES
user_id=537938
I forgot to mention that the Python version used is 2.3a1.
Geert Jansen
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=668708&group_id=5470