[capi-sig] Python2.6 and PyImport_ImportModule
anti00Zero
anti00Zero at gmx.de
Thu Oct 16 11:17:30 CEST 2008
Hello.
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')
cppObjectWeb.SetHTTPHeaderExt(u'')
page = u''
try:
page = u'''<html>
<head>
<title>'''
servername = cppObjectSettings.GetSettingsFromMethod(DeviceFriendlyName)
page += servername
page += u'''</title>
</head>
<body>
<h1>'''
page += servername
page += u'''</h1>
<a href="?f=browse">Browse Directory</a><br />
<a href="?f=settings">Settings</a>
</body>
</html>'''
except:
page = BuildErrorPage()
cppObjectWeb.SetPage(page)
def BuildErrorPage():
page = u'''<html>
<head>
<title>Python Error</title>
</head>
<body>'''
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