New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cx_Freeze 6 has problems with SQLite #296

sekrause opened this Issue Aug 3, 2017 · 3 comments


None yet
3 participants

sekrause commented Aug 3, 2017

When I build a Windows console executable from this very simple test application

import sqlite3
conn = sqlite3.connect(':memory:')

it works fine as long as the current working directory is the application's directory. However, starting this app from any other directory results in the following error:

Traceback (most recent call last):
  File "D:\Temp\freezetest\venv\lib\site-packages\cx_Freeze\initscripts\", line 14, in run
  File "D:\Temp\freezetest\venv\lib\site-packages\cx_Freeze\initscripts\", line 26, in run
    exec(code, m.__dict__)
  File "", line 1, in <module>
  File "c:\Program Files\Python35\lib\sqlite3\", line 23, in <module>
    from sqlite3.dbapi2 import *
  File "c:\Program Files\Python35\lib\sqlite3\", line 27, in <module>
    from _sqlite3 import *
ImportError: DLL load failed: The specified module could not be found.

The reason seems to be that cx_Freeze copies the sqlite3.dll in the same directory as the python35.dll, not the new lib directory, but _sqlite3.pyd expects the sqlite3.dll in its own directory (which is the lib directory).


This comment has been minimized.


anthony-tuininga commented Aug 6, 2017

Patch supplied. Please let me know if that corrects the issue for you!


This comment has been minimized.


sekrause commented Aug 7, 2017

Yes, that fixes the issue.


This comment has been minimized.

karthick1288 commented Jul 11, 2018

hello , Can you please elaborate on how to ensure the sqlite3 dll is loaded in the same directory? Thank you very much

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment