Python embedded - linking problem on Linux - trying again

Kim Petersen kp at kyborg.dk
Wed Aug 14 17:31:19 CEST 2002


Followup on the previous....

Kim Petersen wrote:
> 
> Traceback (most recent call last):
>   File "RM_Gui.py", line 17, in ?
>     import time
> ImportError: /usr/lib/python2.1/lib-dynload/timemodule.so: undefined 
> symbol: PyExc_IOError
> Traceback (most recent call last):
>   File "RM_Gui.py", line 32, in RM_GUI_avail
>     if sys.platform=='win32':
>   File "rmcobol85.py", line 6, in ?
>     import RM_Gui
>   File "RM_Gui.py", line 86, in ?
>     if __name__ == "__main__":
> TypeError: function takes at least 2 arguments (1 given)
> 
> PyExc_IOError seems to be the culprit ????
> 
When thinking about this - it seemed to indicate that the interpretor 
wasn't initialized - and that made me suspect the following code where
i initialize and kill (i've disabled this because of a previous 
suspecion) - everything i do is done in via things loaded or in the
module rmcobol85.py (which is loaded well and good):

int exitPython()
{
	return 1;
	/* deallocate everything */
	Py_DECREF(rmc85_module);
	rmc85_module=NULL;
	if (user_module) {
		Py_DECREF(user_module);
		user_module=NULL;
	}
	/* finally close python down */
	Py_Finalize();
}

int initPython(int reload,int argc,char **argv)
{
	if (reload) {
		exitPython();
	}
	if (Py_IsInitialized()) {
		return 1;
	}
	Py_SetProgramName("/usr/bin/python");
	Py_Initialize();
	PySys_SetArgv(argc,argv);
	rmc85_module=init_rmc85();

	/* Ok vi kan nu loade user modulet (rmcobol85.py) */
	user_module=PyImport_ImportModule("rmcobol85");
	/* Vi gider ikke checke om det rent faktisk blev loaded ...
	 * Alt funktionalitet sker henover exports... med undtagelse
	 * af PYTHON kaldet (og det checker efter om user_module er
	 * NULL eller ej
	 */
	Py_XINCREF(user_module);

	return 1;
}


-- 
Med Venlig Hilsen / Regards

Kim Petersen - Kyborg A/S
IT - Innovationshuset
Havnepladsen 2
7100 Vejle
Tlf. +4576408183 || Fax. +4576408188




More information about the Python-list mailing list