[capi-sig] Python2.6 and PyImport_ImportModule

anti00Zero anti00Zero at gmx.de
Thu Oct 16 11:17:30 CEST 2008


I've use Python 2.5 and want to use Python 2.6.
But I have a problem with PyImport_ImportModule.

c++ code:

PyObject* pModule = PyImport_ImportModule(pBuffer);

pBuffer is for example theme.simple.index

and my script looks like:

import MyModule
import sys

def StartWebInterface(cppObjectWeb, cppObjectSettings):
	cppObjectWeb.SetHTTPHeaderContentType(u'text/html; charset=utf-8')
	page = u''
		page = u'''<html>
		servername = cppObjectSettings.GetSettingsFromMethod(DeviceFriendlyName)
		page += servername
		page += u'''</title>
		page += servername
		page += u'''</h1>
					<a href="?f=browse">Browse Directory</a><br />
					<a href="?f=settings">Settings</a>
		page = BuildErrorPage()

def BuildErrorPage():
	page = u'''<html>
						<title>Python Error</title>
	page += sys.exc_info()
	page += u'</body></html>'
	return page

But the PyImport_ImportModule crashed my c++ program.
The index.py was compiled because a new index.pyc was created.

Thanks for help.
Psssst! Schon vom neuen GMX MultiMessenger gehört? Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger

More information about the capi-sig mailing list