Monday, July 13, 2009

ImportError: dynamic module does not define init function

Don't do the same mistake I did...

If you have compiled your own .dll or .so file and when you are trying to import a python file then make sure your dll filed does not have the same name as one of the python files.

For e.g. if your directory contains the following files:
mymodule.dll
mymodule.so
mymodule.py

and you do

>> python
>> import mymodule

You will get the above error and that is because it is trying to import not from mymodule.py but from mymodule.so/dll.