howto py2exe/py2app for self updating application

Tony Meyer t-meyer at ihug.co.nz
Sat Apr 22 20:06:32 EDT 2006


> I'm creating a GUI program
> with wxPython which will be distributed  for Mac and Windows.
[...]
> The program should be able to update itself
[...]

By default, py2exe puts all the .pyc files used in a zip file.  The  
simplest way to do this it let py2exe do what it normally does.  Code  
all of the .py files as you would when running from source (i.e.  
you'll never explicitly use zipimport).

To update, you then:

   1. Download the new .pyc files.
   2. Expand (use ZipFile) the existing py2exe zip.
   3. Replace the old .pyc files with the new ones.
   4. Rezip (use ZipFile) the .pyc files.
   5. Replace the old py2xe zip with the one containing the new files.
   6. Restart the program.

This works (I use a more sophisticated version of this) well with  
py2exe.  I haven't used py2app at all, but if it works much like  
py2exe, then all of the above still applies (certainly the steps are  
platform-agnostic).

=Tony.Meyer




More information about the Python-list mailing list