When my prog encounters
Import error: dynamic module does not define init function
using Python 2.2.2
Windows 2000 Pro SP3
and the latest SQLite
According to a Google newgroup search:
It's really quite simple. Your C code is missing the
function which is responsible for actually setting up the module for
use. Take a look at the modules that come with Python for examples on
how it should be implemented.
but since I'm using a compiled binary, I don't have any influence on
John W Hall <wweexxss...@telusplanet.net>
Calgary, Alberta, Canada.
"Helping People Prosper in the Information Age"
NB I DO have a file named sqlite.def in the same directory as
sqlite.dll and my Python prog, but it DOES NOT contain any reference
to init or anything similar.
I suppose I could try poking it from a safe distance, but I think the
entries in that list need to be in a particular order, corresponding
to a list of addresses within the module, and I don't have that info
>I'm trying to set up SQLite & PySQLite have the following problem,
>would appreciate some help. TIA
>When my prog encounters
>Import error: dynamic module does not define init function
OOPS. Sorry, guys, it's been a fragmented day
I just realised the problem is not with PySQLite, but the sqlite.dll
and its .def file. I need to contact the SQLite author.
No need to contact the SQLite author.
If you do "import sqlite" Python tries a few different files in a certain
order. I don't remember the exact order, but on Windows, all of
are in the list of imports that will be tried.
The problem is now that in the presence of sqlite.dll, we have both sqlite.dll
and sqlite/__init__.py which apparently is problematic.
Just move the sqlite.dll out of the Python module search path (sys.path) and
you'll be fine.
The Windows version of PySQLite is statically linked against SQLite, so there
is no need to put any sqlite.dll's anywhere. The only thing you can install
(it's still optional) are the mxExtensions in order to have better support for
Date, Time, DateTimeDelta, etc. (through mxDateTime).
Many thanks, Gerhard. I now have that working.
I have advanced to a couple of other problems but I'll work on those
for a while before requesting help.