I made a simple application in Python 3.6 and SQLite3.
When I generate the main program executable by cx_Freeze and install it on the machine I developed the application (where Python and SQLite are installed), the application works fine, including, deleting, querying and changing the data in the databases.
The problem is when I install this application on another computer that does not have Python and SQLite installed. When there is an interaction with the databases, it does not return any error and simply the program does not respond, as if it were not accessing the databases.
What do I still need to put in the setup.py file so that the application can effectively access SQLite databases? Do I have to put any more command on the programs that access the bases? To help, I refer below the program setup.py and a program that accesses SQLite.
Setup.py program:
#setup.py
import os
import sys
os.environ['TCL_LIBRARY'] = "C:\Users\Paulo\AppData\Local\Programs\Python\Python36\tcl\tcl8.6"
os.environ['TK_LIBRARY'] = "C:\Users\Paulo\AppData\Local\Programs\Python\Python36\tcl\tk8.6"
from cx_Freeze import setup, Executable
setup(
name = "Sistema RMI",
version = "1.0.2",
options = {"build_exe": {
'packages': ["os","sys","ctypes","time","sqlite3","datetime"],
'include_files':[r"C:\Users\Paulo\AppData\Local\Programs\Python\Python36\DLLs\tcl86t.dll",
r"C:\Users\Paulo\AppData\Local\Programs\Python\Python36\DLLs\tk86t.dll",
r"C:\Users\Paulo\AppData\Local\Programs\Python\Python36\DLLs\sqlite3.dll"],
'include_msvcr': True,
}},
executables = [Executable("PgmPrin.py",base="win32GUI")]
)
Database Access Program:
import sqlite3
class BancoInpcDB():
def __init__(self):
self.conexao = sqlite3.connect('bancoInpcDB.db')
self.createTable()
def createTable(self):
c = self.conexao.cursor()
c.execute("""create table if not exists inpc (
anomes integer primary key ,
percentual numeric(2,4) not null,
validacao char(1) not null)""")
self.conexao.commit()
c.close()