0
I made a simple application in Python 3.6 and Sqlite3.
When I run the main program by cx_Freeze and install it on the machine I developed the application on (where Python and Sqlite are installed), the application works well, including deleting, consulting and changing the data in the databases.
The problem is when I install this application on another computer that does not have Python or Sqlite installed. When there is an interaction with the databases, no error returns and simply the program gives no answer, as if not accessing the databases.
What do I still need to put in the setup.py file so the application can effectively access Sqlite databases? I have to put some more command in the programs that access the bases?
To assist, I refer below the setup.py program and a program that accesses the Sqlite.
Program setup.py:
#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")]
)
Program that accesses database:
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()