setting icon using py2exe?

Chris Liechti cliechti at
Tue Jun 29 23:30:52 CEST 2004

Grant Edwards <grante at> wrote in
news:slrnce3gcc.89j.grante at 

> I'm trying in vain to set the icon for the executable generated
> by py2exe.  According to various sources there are two answers:
>  1) Do it on the command line:
>        python py2exe --icon foo.ico
>     That generates a usage error:
>        error: --icon not recognized

that is for versions < 0.4
it is not longer supported in 0.5+

>  2) According to
>     you can set the icon_resources in the like this:
>       #
>       from distutils.core import setup
>       import py2exe
>       setup(windows=[{"script":"","icon_resources":[(1,"riv
>       atek.ico")]}]) 
>       RuntimeError: MapExistingFile: The handle is invalid.
> Has anybody really been able to set the icon for the executable
> generated by py2exe?

yes, works fine here:
    windows = [
        { 'script': "",  'icon_resources': [(0x0004, 
i was told that the ID does not matter that much, it will just take the 
first icon resource. i somewhere saw the use of 4, so i tested with that 
number and since it worked for me, i didn't change it


Chris <cliechti at>

More information about the Python-list mailing list