Here are my files that i have in a folder ready for compile...
After using pyinstaller i now have my compiled folder complete...
However, as you can see codes.db file is not in the folder as expected!
That is until i click the .exe to launch...then all of a sudden the .exe spits out an empty codes.db file showing 0kb and have no tables. I am assuming at this point that because the codes.db is missing the .exe creates an empty .db with the same name.
How can i make sure that my sqlite3 db is included in the compile? It needs to still have its read/write capability.
EDIT
Im using Windows 10 and Visual Studio 2017.
I don't see your .spec file. Running
pyinstaller file.py
produces a file.spec file. This file should be edited by the user to fit his needs. One hassle free way i found is to have the db in a folder and add the folder, setting datas in analysis to
[
( './db/*', 'db' ),
]
You can view my complete answer on SO here: sqlite + PyQt5 to standalone exe - Python 3.6.3 + Pyinstaller
Related
I have a python script using tensorflow, websockets and some other libraries. The problem is when I create a onefile .exe file with pyinstaller which results in a very large size (About 530Mb). Now, I know this is mainly because of Tensorflow, and I am also using a virtual environment, so only the necessary libraries are being packed in the .exe file but for some reason, sometimes when I do a small change in the code an build it again using the same .spec file, importing the same libraries and not even deleting the __pycache__ or the build folders, the .exe file created is way smaller (about 345Mb). I have no idea why this happens and when does this happens. Does anyone has an idea of why this can happen?
PS. I am using pyinstaller 4.10 and pyinstaller-hooks-contrib 2022.2 I tried changing the pyinstaller version, but it does not help on reducing the size of the .exe file
I am a python developer and I made a program and packed it with inno setup.
inno setup automatically creates 2 files one of them a unins000.dat file and a unins000.exe file
when starting the .exe it will fully uninstall everything that you installed including the exe itself
now the 2 problems I have with this is:
it also creates a .dat file and I just want 1 exe to uninstall the entire program
the exe and dat files are both called unins000 and not just uninstall
(I have already tried renaming them but then the exe just doesn't work anymore)
so I found a way to disable the creation of these files
so now I am trying to create a .exe file that can delete the entire directory it is in including itself
I have started using python so I coded a script which deletes the entire dir the python script is in
but when I package it into an exe using pyinstaller it doesn't work anymore
How can I make an executable that when run deletes the directory where it is in including itself?
You can create exe that after start makes copy of itself into temp folder, then starts this copy and stops original process. Then the second process can delete whole folder. Then after some time OS should delete file left in temp folder on it's own.
I am completely new to python and trying to create an application (or .exe) file for python using pyinstaller. I ran the command pyinstaller -[DIRECTORY].py and it saved it to an output directory "C:\Windows\System32\Dist\Foo", however when i tried to locate the directory it did not seem to exist (Dist).
NOTE: i'm trying to convert a .py file to .exe file in Python 3.5
Thanks for any help :)
If you set your command directory to the .py script location and run pyinstaller yourscript.py, it will generate folders in the same location as your script. The folder named dist/ will contain the .exe file.
Could you please try easily the command:
`pyinstaller yourscript.py`
You will get your output folder anyway if everything is correct with your software/module.
Second you can have no rights into System32 folder, so you could try a different folder.
Third you might have inconsistency with the path \ or /.
Hope those three suggestions will lead you to the correct solution :-)
Have a nice day.
I'm making onefile executables with pyinstaller on windows 10. I'm including data files (pickle files) by editing the .spec file...
How can I store changes made to these files during run time? My understanding is that the data files are copied to a temp directory during execution. I can read from the files using the path I get from sys._MEIPASS but the changes I write are lost after restarting the program.
Is there a way to write to pickle files stored inside the exe?
I've written a Python program which I distribute using pyinstaller. I've been using the onefile option so far to create a standalone executable. That's been great up until now, but as the application has grown the startup time is getting a bit long. I'd also like users to install the application properly to make upgrading simpler.
I've been trying to create a single directory version of the app using pyinstaller's onedir option. However, the resulting .exe file that is created requires admin privileges to run, which the onefile version did not. The program itself doesn't need any such privileges so I assume this is something that pyinstaller is doing. How do I create an application that doesn't require admin privileges?
Additional info:
Python 2.6, pyinstaller v1.4
Application uses PyQt4 and pygame modules.
Trying to create executable for Windows 7.
Using -w pyinstaller option to create a windowless executable.
admin privileges could be asked in few cases:
A. if the executable name contains relevant keywords (like setup, install, update or patch)
B. the application requests it in it's manifest.
C. the .exe file name do not match the name in the manifest file.
if you create a .spec file for your application package, you can add
exe = EXE(
...
manifest=None,
...
)
and it won't ask for password, unless you rename it to setup or install.
I have recently run into this issue, and my experience in solving it was thus:
PyInstaller with --onefile option creates a manifest file in the 'executable'. This manifest file on Windows tells the OS a few things about the application it is bundled with. One of the things it specifies, is the application name/manifest file. The format of the manifest filename is appname.exe.manifest. If your program is frozen with PyInstaller, the executable name that it stores in the manifest will be the name given to the completed EXE under the /dist folder of PyInstaller. IF you rename the EXE, the manifest file packed with it is no longer matching! Therefore, create a manifest file with the same name as the final EXE filename and run PyInstaller with the --manifest option, OR don't rename the EXE that PyInstaller creates.
When you package the PyInstaller project with the custom --manifest, the renamed program no longer requests administrator elevation.