Python crash in PyImport_ImportModule

Michael Hudson mwh at
Thu Feb 21 07:49:50 EST 2002

AdrianLeu at (Adrian Leu) writes:

> Hi ! I am getting at the end of my tether with Python. 
> I have written a script in Python 2.0 under Windows 2000. I call this
> script from inside a C++ class method which has the Py_Initialize()
> and Py_finalize() in its constructor and destructor respectively.
> Everything seemed to work OK. However, recently a crash started to
> appear and it cannot be repeated always. It is in the
> PyImport_ImportModule(module_name) function and the stack looks like
> this:

I don't know if this is the cause of your problem but some versions of
Python have problems when you call Py_Initialize/Py_Finalize
repeatedly.  Perhaps you could write a tiny problem that calls these
functions in a loop and see if that crashes?  If it does, you should
probably trying upgrading your Python.  If it doesn't, you have some
other problem -- from your stack trace, I'd guess it's some kind of
heap corruption, so good luck.


  Whaaat? That is the most retarded thing I have seen since, oh,
  yesterday                             -- Kaz Kylheku, comp.lang.lisp

More information about the Python-list mailing list