PySQLite ... does not define uinit function... Help

187 Aufrufe
Direkt zur ersten ungelesenen Nachricht

John Hall

ungelesen,
17.03.2003, 21:21:5617.03.03
an
I'm trying to set up SQLite & PySQLite have the following problem,
would appreciate some help. TIA

When my prog encounters

import sqlite

I get
Import error: dynamic module does not define init function
(initsqlite)

Installed sqlite-python-0.4.1.win32.exe,
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
init<modulename>()
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
that.

--
John W Hall <wweexxss...@telusplanet.net>
Calgary, Alberta, Canada.
"Helping People Prosper in the Information Age"

John Hall

ungelesen,
17.03.2003, 21:38:2517.03.03
an
On Tue, 18 Mar 2003 02:21:56 GMT, John Hall
<wweexxss...@telusplanet.net> wrote:
>When my prog encounters
>
>import sqlite
>
>I get
>Import error: dynamic module does not define init function
>(initsqlite)
>

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
(readily) available.

John Hall

ungelesen,
17.03.2003, 21:48:4017.03.03
an
On Tue, 18 Mar 2003 02:21:56 GMT, John Hall
<wweexxss...@telusplanet.net> wrote:

>I'm trying to set up SQLite & PySQLite have the following problem,
>would appreciate some help. TIA
>
>When my prog encounters
>
>import sqlite
>
>I get
>Import error: dynamic module does not define init function
>(initsqlite)
>

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.

Gerhard Haering

ungelesen,
18.03.2003, 04:25:3318.03.03
an
* John Hall <wweexxss...@telusplanet.net> [2003-03-18 02:48 +0000]:
> On Tue, 18 Mar 2003 02:21:56 GMT, John Hall:

>
> >I'm trying to set up SQLite & PySQLite have the following problem,
> >would appreciate some help. TIA
> >
> >When my prog encounters
> >
> >import sqlite
> >
> >I get
> >Import error: dynamic module does not define init function
> >(initsqlite)
> >
>
> 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

sqlite.py
sqlite/__init__.py
sqlite.dll
sqlite.pyd

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).

HTH,

-- Gerhard

John Hall

ungelesen,
18.03.2003, 07:55:3618.03.03
an
On Tue, 18 Mar 2003 10:25:33 +0100, Gerhard Haering
<gerhard...@gmx.de> wrote:
>...

>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.

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.

Allen antworten
Dem Autor antworten
Weiterleiten
0 neue Nachrichten