[C++-sig] Re: multiple registrations of to-Python converter warning

Lutz Paelike lutz_p at gmx.net
Wed Apr 21 13:05:55 CEST 2004


I can now describe the problem more precisely.

I thought the initModulename() function is called multiple times in a single Python session
but my program calls Py_Finalize() before that.
So my program structure looks like this:

///////////////////////////////////////////////////////////////////////////
void initPython(){
	if (Py_IsInitialized()) return;
	PyImport_AppendInittab("Modulename", initModulename);
	Py_Initialize();
	Py_SetProgramName("[none]");
	// This issues the warning
	initModulename();
}

void unloadPython(){
	// ... some more code
	Py_Finalize();
}

if do this now:

initPython()
unloadPython()
// second call to init
initPython()
unloadPython()
//////////////////////////////////////////////////////////////////////////////

On the second call to initPython the initModulename() issues this warning.
Am i missing something here? I want to be able to shutdown Python completely and to reinitialize it.
Py_IsInitialized() tells me correctly that on the second call Python is not initialized any more but
Boost.Python seems to hold something back...

The program works but this warning makes me wonder if this is the right way to do it...


Thank you,

Lutz

-- 
------------------<snip>----------------
Lutz Paelike
Stargarder Str. 47
10437 Berlin
++(49)-(0)30-44009581
mail:	lutz at fxcenter.de
	lutz_p at gmx.net
pgp key id: 0xA7B25440
pgp key server: x-hkp://wwwkeys.pgp.net
pgp fingerprint: 9064 F4E1 D754 C2FF 1619 305B C09C 5A3B 57F3 BF04
------------------<snip>----------------




More information about the Cplusplus-sig mailing list