Embedding Pythonwin - Python reports Fatal Error

rfisher at iee.org.uk rfisher at iee.org.uk
Fri Sep 22 14:12:03 EDT 2000


I'm trying to embed Python in an application to add scripting to it.
To add an interactive window I'd like to use Pythonwin.

I have been following the documentation at
http://www.python.org/windows/pythonwin/EmbeddingWin32ui.html

Everything compiles nicely, but when I call
Win32uiHostGlue::DynamicApplicationInit() the application crashes with
the message "Fatal Python error: Can not setup interpreter state, as
current state is invalid" in the trace window.

Further investigation reveals that this error occurs on the line in
Win32uiHostGlue.h that reads:

rc = (*pfnInit)(this, (char *)cmd, additionalPaths);

I've looked at what this does but there are no clues as to what the
problem might be.  The error seems to be generated by Python rather
than Pythonwin, so perhaps I am missing something during
initialisation.  Anyone have any ideas?

Are there any examples of Pythonwin embedded in an application floating
around?  Failing that, can anyone suggest a good way of implementing an
interactive Python window under VC++/MFC ?  I think that Python is an
excellent way to add scripting to an application, and an interactive
window would make it so much more fun for the user!

thanks,
Rob.


Sent via Deja.com http://www.deja.com/
Before you buy.



More information about the Python-list mailing list