I successfully packaged my Kivy app for Windows using PyInstaller and my app.exe runs without any problems. (.spec: Kivy 1.9.1 Windows package .spec single exe)
For easier distribution I want to package my file to a single standalone .exe. My .nsi file:
SilentInstall silent
Section
InitPluginsDir
Setoutpath KanjiOrigin
File /r "distKanjiOrigin*"
ExecWait "distKanjiOriginKanjiOrigin.exe"
Setoutpath $TEMP
SectionEnd
A .exe is build without error: http://pastebin.com/h91jzGgY
However when running this .exe made by NSIS, the app runs until I need to connect to my internal database at datadbKanji-story.db
, which is not found. (When opening the .exe, it is in there, so the database has been included).
sqlite3.OperationalError: unable to open database: datadbKanji-story.db
When I extract my .exe with 7zip and try to run the KanjiOrigin.exe from PyInstaller, I get the following error: D:pathKanjiOriginKanjiOrigin.exe is not a valid Win32 application
. (Not sure if this is relevant).
Edit 2
I don't know what changed, but when opening the NSIS .exe with 7zip now, it doesn't give an error extracting the PyInstaller .exe anymore.
However when trying to run the extracted PyInstaller .exe, I get the following error:
PyInstaller Bootloader 3.x
LOADER: executable is D:pathKanjiOriginKanjiOrigin.exe
LOADER: homepath is D:pathKanjiOrigin
LOADER: _MEIPASS2 is NULL
LOADER: archivename is D:pathKanjiOriginKanjiOrigin.exe
LOADER: pyi_arch_check_cookie failed
LOADER: archivename is D:pathKanjiOriginKanjiOrigin.pkg
LOADER: Cannot open archive: D:pathKanjiOriginKanjiOrigin.pkg
Cannot open self D:pathKanjiOriginKanjiOrigin.exe or archive D:pathKanjiOriginKanjiOrigin.pkg
Also the included database doesn't seem to be corrupted, because after extraction I can successfully open it with sqlitebrowser (http://sqlitebrowser.org/).
What do I do wrong? Is it Setoutpath $TEMP
?
Edit:
If I manually include the database with the same folder structure (datadbKanji-story.db
) outside the NSIS created .exe, it can find the database? Why can it find an external database, but not the internal one included in the NSIS .exe?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…