Problem using python C API

marcglec at free.fr marcglec at free.fr
Fri Jan 16 16:30:12 CET 2009


Right, thx for your reply, I completely overlooked "examplemodule.so"
in the building step. Maybe I should sleep more these days :)
Btw, I've now an other problem with PyArg_ParseTuple but I guess
it is better to post in the capi-sig mailing list.
Thx again,
Marc.


>
> On Jan 16, 2009, at 5:31 AM, shi dingan wrote:
>
> > void initexample() {
> >  PyObject *m;
> >  m = Py_InitModule("example", exampleMethods);
> > }
> >
> > When I try to import examplemodule, I obtain the following message:
> >>>> import examplemodule
> > Traceback (most recent call last):
> >  File "<stdin>", line 1, in ?
> > ImportError: dynamic module does not define init function
> > (initexamplemodule)
>
> Hi Marc,
> The tutorial says, "The initialization function must be named
> initname(), where name is the name of the module". The error message
> you got is very accurate: "module does not define init function
> (initexamplemodule)". Since your module is called "examplemodule",
> Python is looking for a function called "initexamplemodule".
>
> Change your build step to build a module called "example" and not
> "examplemodule" and I think you'll be OK.
>
> bye
> Philip
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>





More information about the Python-list mailing list