Further problems extending Python (cerr undefined)

JB jblazi at hotmail.com
Fri Dec 13 15:04:41 EST 2002


I receive the following error message, when I am trying to 
load my extension module:

bz at linux:~/python-programs/python-konstruktion> python 
extest.py
Traceback (most recent call last):
  File "extest.py", line 1, in ?
    import pythongeo
ImportError: ./pythongeo.so: undefined symbol: cerr
bz at linux:~/python-programs/python-konstruktion>


Here is my extension C++ file:

#include <Python.h>

#include "CORE.h"
//using namespace std;
//using namespace CORE;

struct Object {
  int typ;
  double x1,y1,x2,y2;
  int par1,par2,d;
  char *text, *pos;
  float w, dw;
  };


static PyObject *PythongeoError;

extern "C" PyObject *make_object(PyObject *self,PyObject 
*args)
{
  int ok,typ,par1,par2,d;
  float x1,y1,x2,y2,w,dw;
  char *text, *pos;

  ok = 
PyArg_ParseTuple(args,"iffffiiissff",&typ,&x1,&y1,&x2,&y2,&par1,&par2,&d,&text,&pos,&w,&dw);

//  printf("make_object: 
%d,%f,%f,%f,%f,%f,%d,%d\n",typ,x1,y1,x2,y2,par1,par2);
  return Py_BuildValue("i",1);
}

static PyMethodDef PythongeoMethods[] = {
    {"makeobj",make_object,METH_VARARGS,"Create new Geometry 
Object"},
    {NULL, NULL, 0, NULL}        /* Sentinel */
};


extern "C" void initpythongeo(void)
{
    PyObject *m, *d;
    m = Py_InitModule("pythongeo",PythongeoMethods);
    d = PyModule_GetDict(m);
    PythongeoError = PyErr_NewException("pythongeo.error", 
NULL, NULL);
    PyDict_SetItemString(d, "error", PythongeoError);
}

Can somebody help me?

TIA,
-- 
Janos Blazi



More information about the Python-list mailing list