0

I'm working on a project which implements sqlite databases from Python 3.6. It works fine when the script is run from the editor, but when I freeze it using cx_Freeze, the executable crashes immediately. It appears to be the line 'import sqlite3' that causes the problem (the executable runs as expected otherwise):

import sqlite3
print("Done")
input()

causes a crash, but

# import sqlite3
print("Done")
input()

works fine. Some other websites suggested I should put the sqlite3 source code in my project folder, but I haven't managed to find a way of doing that. Is that the right approach, and if so, how should I go about it? OS is Windows 10 and setup script is

import sys
from cx_Freeze import setup, Executable

setup(
    name="Test Executable",
    version="1.0",
    description="sqlite test exe"
    executables=[Executable("test.py", base=None)]
)
  • 1
    Is the error something about "No module named sqlite3"? `sqlite3` is included in the standard library so you shouldn't be seeing that error. What version of Python is this? What OS is it? – FamousJameous Apr 12 '17 at 22:16
  • I'm using Python 3.6 and Windows 10. I'm afraid I'm quite new to running scripts as executables and don't know how to pause the window after the error but before it closes itself... – QuadraticOne Apr 12 '17 at 22:53
  • Open a command prompt (`Windows`+`r`) type `cmd` and hit enter. Type `cd ` in the new window and then paste in the full path to the folder your script is in. (eg. `C:/Users/user/Documents/scripts` or whatever it is.) Then type `python ` and the name of the script. Update your post with the output – FamousJameous Apr 13 '17 at 17:57
  • It appears to be something to do with the drivers. I've switched to using Python 2.7 and py2exe to convert to .exe, which works much better. Thanks for your help! – QuadraticOne Apr 17 '17 at 15:19

0 Answers0