classification
Title: Can't import sqlite3 in Python 2.6b1
Type: behavior Stage:
Components: Extension Modules, Windows Versions: Python 2.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: loewis Nosy List: amaury.forgeotdarc, craigneuro, loewis
Priority: release blocker Keywords:

Created on 2008-06-27 13:14 by craigneuro, last changed 2008-06-30 07:00 by loewis. This issue is now closed.

Messages (3)
msg68827 - (view) Author: Craig Holmquist (craigneuro) Date: 2008-06-27 13:13
This is observed on Windows XP; I don't know if it affects other platforms.

Trying to import sqlite3 gives this error:
>>> import sqlite3

Traceback (most recent call last):
  File "<pyshell#1>", line 1, in <module>
    import sqlite3
  File "C:\Python26\Lib\sqlite3\__init__.py", line 24, in <module>
    from dbapi2 import *
  File "C:\Python26\lib\sqlite3\dbapi2.py", line 27, in <module>
    from _sqlite3 import *
ImportError: DLL load failed: The specified module could not be found.

A look at the dependencies for _sqlite3.pyd shows that it's trying to
link to a file called sqlite3.pyd, which doesn't exist.  Renaming
sqlite3.dll to sqlite3.pyd doesn't work either, because then "import
sqlite3" causes Python to try to import that file as a Python module
(instead of C:\Python26\Lib\sqlite3\__init__.py).

In Python 2.5.2, the _sqlite3.pyd module correctly links to sqlite3.dll.

If there's already an issue regarding this I couldn't find it.
msg68830 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2008-06-27 14:17
Confirmed here.
As a workaround, you may rename sqlite3.dll to SQLITE3.pyd, with some
uppercase letters: the dll loader won't care, but the python import does
check for case consistency.

There is a problem in PCBuild/sqlite3.vcproj, which is supposed to build
sqlite3.dll:
"OutputFile" is defined to a name ending with ".dll" for Relase and
Debug builds, but not for the PGInstrument and PGUpdate builds: this
property is inherited from pyd.vcprops, which defines a name ending with
".pyd".
Of course, the distribution is a PGUpdate build...

Martin, I suspect that you already corrected this in your distribution
workspace, but the _sqlite3.pyd file was not rebuilt:

>dir c:\python26\DLLs\*sqlite3*
 [...]
2008-06-19  13:56              247,296 sqlite3.dll
2008-06-19  13:53               40,960 _sqlite3.pyd

The .dll is newer that the .pyd, when the project dependencies are in
the other direction.
msg68998 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2008-06-30 07:00
This is now fixed in r64597. I had indeed edited the project file before
the release, but couldn't commit, as that would have modified the tag. I
had rebuilt sqlite3.dll, but probably forgotten to rebuild _sqlite3.pyd.

There are more issues with the PG builds, such as the .lib files not
being created in the pgo directory (only in pgi).
History
Date User Action Args
2008-06-30 07:00:12loewissetstatus: open -> closed
resolution: fixed
messages: + msg68998
2008-06-27 22:49:17loewissetpriority: release blocker
2008-06-27 14:17:35amaury.forgeotdarcsetassignee: loewis
messages: + msg68830
nosy: + amaury.forgeotdarc, loewis
2008-06-27 13:14:01craigneurocreate