Restarting a self-updating python script

前端 未结 8 725
小鲜肉
小鲜肉 2020-11-30 18:48

I have written a script that will keep itself up to date by downloading the latest version from a website and overwriting the running script.

I am not sure what the

8条回答
  •  有刺的猬
    2020-11-30 18:56

    The cleanest solution is a separate update script!

    Run your program inside it, report back (when exiting) that a new version is available. This allows your program to save all of its data, the updater to apply the update, and run the new version, which then loads the saved data and continues. To the user this can be completely transparent, as they just run the updater-shell which runs the real program.

提交回复
热议问题