Issue
I have a PyQt
application ready to release. Everything works pretty well and I only have one more thing to wrap up. I love software that updates itself:
- check url for new version;
- new version found;
- notify user of updates (click) → update.
The problem is that I don't know how to perform this update. I check, I find new version, I download it and then I must close the application and execute the installer of the new version. If I close it then I can't execute anything else, If I execute the installer I can't close the application.
Based on some user choices my program also downloads and installs some third party software which needs the same thing: close before install program, restart after install program.
Solution
After downloading the installer for the newer version, you can use atexit.register()
with os.exec*()
to run the installer, e.g. atexit.register(os.execl, "installer.exe", "installer.exe")
. This will make the installer start when the application is about to exit. The application will immediately exit after the os.exec*()
call, so no race condition will occur.
Answered By - Ramchandra Apte
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.