I wrote a program in Python 2.7 for my office. Using PyInstaller with the --onefile flag, I've compiled it into a single EXE file to distribute to my co-workers. What I'm trying to figure out now is how to supply updates automatically but still keep the program as a single file.
My current method is to have the program alert the user of a new version and give instructions where to obtain the updated file. This works, but I want to find some method of updating without the user's involvement.
I am aware of Esky, which can create auto-updating Python programs, but as far as I can tell, it requires the program to exist as multiple files.
Any suggestions on how I make a standalone, single file EXE python program that can auto-update?
__file__
to know the current location of the executableuse sys.execcv or subrocess alternative to replace the current running process with a small script something like
"sleep(1) & copy {tempfile} {filename}".format(tmp_file,__file__)
(simple batch commands that overwrite the old exe with the new exe)