A
A
AirronBark2021-12-25 19:57:05
Python
AirronBark, 2021-12-25 19:57:05

Why are commands to sqlite3 not executed in the .exe file of the program (Pyqt5)?

I wrote a program in Pyqt5 using the sqlite3 database, but when I pack it into .exe format using py2exe, the windows associated with the database do not open, the program just crashes.
In the python file everything works fine.
The table itself is there, I transferred the database to the root with the executable file .

Traceback (most recent call last):
  File "Main_app_V0.9.py", line 892, in <module>
  File "Main_app_V0.9.py", line 886, in application
  File "Main_app_V0.9.py", line 27, in __init__
  File "db_connection.pyc", line 56, in delite_save_1
sqlite3.OperationalError: no such table: savedata_1


This is setup:

from setuptools import setup
import platform
from glob import glob


SETUP_DICT = {

    'data_files': (
        ('', glob(r'C:\Windows\SYSTEM32\msvcp100.dll')),
        ('', glob(r'C:\Windows\SYSTEM32\msvcr100.dll')),
        ('platforms', glob(r'C:\Program Files (x86)\Python38-32\Lib\site-packages\PyQt5\Qt\plugins\platforms\qwindows.dll')),
        ('images', ['icons\attantion.png']),
        ('sqldrivers', glob('C:\Program Files (x86)\Python38-32\Lib\site-packages\PyQt5\Qt\plugins\sqldrivers\qsqlite.dll')),
    ),
    'windows': [{'script': 'Main_app_V0.9.py'}],
    'options': {
        'py2exe': {
            'includes': ["lxml._elementpath", "PyQt5.QtGui","PyQt5.QtWidgets","PyQt5.QtCore", "PyQt5.QtCore","db_connection", "config"],
        },
    }
}

if platform.system() == 'Windows':
    import py2exe
    SETUP_DICT['windows'] = [{
        'script': 'Main_app_V0.9.py',
        'icon_resources': [(0, r'icon.ico')]
    }]
    SETUP_DICT['zipfile'] = None

setup(**SETUP_DICT)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vindicar, 2021-12-25
@AirronBark

> The table itself is, I transferred the database to the root with the executable file.
Those. you're not trying to pack the database, are you?
Are you sure the script finds it? Are you specifying the full path to the database file? Or, as always, relative, and maybe the current working directory will be correct?
It's just that some py -> exe packers, when the executable is launched, unpack the script into a temporary directory, and work from there ... and then the database file will not be next to the script. I don't remember if py2exe does this, find out.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question