Search code examples
pythonsqlitepython-2.5

Python 2.5 and sqlite3: DLL load failed


When I type

import sqlite3

in Python 2.5 interpreter (C:\Python25\Python), I get following error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\QGIS\python\sqlite3\__init__.py", line 24, in <module>
    from dbapi2 import *
  File "C:\QGIS\python\sqlite3\dbapi2.py", line 27, in <module>
    from _sqlite3 import *
ImportError: DLL load failed: Specified module not found.

A message box with the message "sqlite3.dll not found" appears (Original German message: "Das Programm kann nicht gestartet werden, da sqlite3.dll auf dem Computer fehlt. Installieren Sie das Programm erneut, um das Problem zu beheben.").

According to documentation, sqlite3 is included with Python 2.5 (I don't need to install it separately).

Also, when I look into directory C:\Python25\DLLs, I find sqlite3.dll there.

What can I do in order to fix this problem?

Note that I have 3 different versions of Python on my machine.


Solution

  • Removing C:\QGIS\python from PYTHONPATH environment variable fixed the issue.

    Before:

    C:\Program Files\OpenLibraries\python;C:\opus\src;C:\PopGen;C:\QGIS\python;
    C:\Python25\Lib\site-packages\django
    

    After:

    C:\Program Files\OpenLibraries\python;C:\opus\src;C:\PopGen;
    C:\Python25\Lib\site-packages\django