Masaru hat geschrieben:Hmmm ... ich würde auf eine fehlerhafte Installation tippen (oder gar Kompilierung).
Welche Version von Python hast du denn installiert (2.5 oder 2.5.1 - Development, Release oder Final)?
tatsächlich, das scheint so zu sein.
im release build geht es.
installiert habe ich 2.5, da mir beim windows-installer allerdings die "python_d.dll" und die "python_d.dll" gefehlt haben, habe ich nochmal den py-source runtergeladen und selbst kompiliert, danach hatte ich auch die fehlenden Dateien... die hab ich dann einfach in die entsprechenden Ordner kopiert.
allerdings habe ich
ohne das bsddb-Modul kompiliert. ist das schon der Fehler?
@ birkenfeld: der aufrufende Code ist nix spannendes:
Code: Alles auswählen
int main(int argc, char *argv[])
{
string message = "helas!";
Py_Initialize();
PyObject *pName, *pModule, *pDict, *pFunc, *pArgs, *pValue, *pMessage;
pName = pModule = pDict = pFunc = pArgs = pValue = pMessage = 0;
pMessage = PyString_FromString(message.c_str());
// Initialize the Python Interpreter
//Py_Initialize();
// Build the name object
pName = PyString_FromString("logger");
// Load the module object
if(pName)
pModule = PyImport_Import(pName);
// pDict is a borrowed reference
if(pModule)
pDict = PyModule_GetDict(pModule);
// pFunc is also a borrowed reference
if(pDict)
pFunc = PyDict_GetItemString(pDict, "logMsg");
if (pFunc && PyCallable_Check(pFunc)) {
pArgs = PyTuple_New(1);
PyTuple_SetItem(pArgs, 0, pMessage);
if(pArgs){
pValue = PyObject_CallObject(pFunc,pArgs );
if (pValue) {
long l = PyInt_AsLong(pValue);
std::stringstream s;
s << l;
std::string asd = s.str();
//printf("Return of call : %d\n", PyInt_AsLong(pValue));
Py_DECREF(pValue);
}else{
PyErr_Print();
}
}
}
else{
PyErr_Print();
}
// Clean up
if(pModule)
Py_DECREF(pModule);
if(pName)
Py_DECREF(pName);
if(pMessage)
Py_DECREF(pMessage);
// Finish the Python Interpreter
Py_Finalize();
return 0;
}
thx für eure Hilfe
