G
Grant Edwards
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 setup.py py2exe --icon foo.ico
That generates a usage error:
error: --icon not recognized
2) According to http://starship.python.net/crew/theller/moin.cgi/CustomIcons
you can set the icon_resources in the setup.py like this:
# setup.py
from distutils.core import setup
import py2exe
setup(windows=[{"script":"vfcupdate.py","icon_resources":[(1,"rivatek.ico")]}])
That doesn't work either:
running py2exe
[...]
copying C:\Python23\Lib\site-packages\wx\wxmsw251h_html_vc.dll -> C:\cygwin\home\admin\othertools\dist
copying C:\Python23\Lib\site-packages\wx\wxbase251h_vc.dll -> C:\cygwin\home\admin\othertools\dist
copying C:\PYTHON23\w9xpopen.exe -> C:\cygwin\home\admin\othertools\dist
copying C:\WINDOWS\SYSTEM\python23.dll -> C:\cygwin\home\admin\othertools\dist
copying C:\Python23\Lib\site-packages\py2exe\run_w.exe -> C:\cygwin\home\admin\othertools\dist\vfcupdate.exe
Traceback (most recent call last):
File "setup.py", line 5, in ?
setup(windows=[{"script":"vfcupdate.py","icon_resources":[(1,"rivatek.ico")]}])
File "C:\PYTHON23\lib\distutils\core.py", line 149, in setup
dist.run_commands()
File "C:\PYTHON23\lib\distutils\dist.py", line 907, in run_commands
self.run_command(cmd)
File "C:\PYTHON23\lib\distutils\dist.py", line 927, in run_command
cmd_obj.run()
File "C:\Python23\Lib\site-packages\py2exe\build_exe.py", line 197, in run
self.create_binaries(py_files, extensions, dlls)
File "C:\Python23\Lib\site-packages\py2exe\build_exe.py", line 395, in create_binaries
arcname, target.script)
File "C:\Python23\Lib\site-packages\py2exe\build_exe.py", line 577, in build_executable
add_icon(unicode(exe_path), unicode(ico_filename), ico_id)
RuntimeError: MapExistingFile: The handle is invalid.
Has anybody really been able to set the icon for the executable
generated by py2exe?
by py2exe. According to various sources there are two answers:
1) Do it on the command line:
python setup.py py2exe --icon foo.ico
That generates a usage error:
error: --icon not recognized
2) According to http://starship.python.net/crew/theller/moin.cgi/CustomIcons
you can set the icon_resources in the setup.py like this:
# setup.py
from distutils.core import setup
import py2exe
setup(windows=[{"script":"vfcupdate.py","icon_resources":[(1,"rivatek.ico")]}])
That doesn't work either:
running py2exe
[...]
copying C:\Python23\Lib\site-packages\wx\wxmsw251h_html_vc.dll -> C:\cygwin\home\admin\othertools\dist
copying C:\Python23\Lib\site-packages\wx\wxbase251h_vc.dll -> C:\cygwin\home\admin\othertools\dist
copying C:\PYTHON23\w9xpopen.exe -> C:\cygwin\home\admin\othertools\dist
copying C:\WINDOWS\SYSTEM\python23.dll -> C:\cygwin\home\admin\othertools\dist
copying C:\Python23\Lib\site-packages\py2exe\run_w.exe -> C:\cygwin\home\admin\othertools\dist\vfcupdate.exe
Traceback (most recent call last):
File "setup.py", line 5, in ?
setup(windows=[{"script":"vfcupdate.py","icon_resources":[(1,"rivatek.ico")]}])
File "C:\PYTHON23\lib\distutils\core.py", line 149, in setup
dist.run_commands()
File "C:\PYTHON23\lib\distutils\dist.py", line 907, in run_commands
self.run_command(cmd)
File "C:\PYTHON23\lib\distutils\dist.py", line 927, in run_command
cmd_obj.run()
File "C:\Python23\Lib\site-packages\py2exe\build_exe.py", line 197, in run
self.create_binaries(py_files, extensions, dlls)
File "C:\Python23\Lib\site-packages\py2exe\build_exe.py", line 395, in create_binaries
arcname, target.script)
File "C:\Python23\Lib\site-packages\py2exe\build_exe.py", line 577, in build_executable
add_icon(unicode(exe_path), unicode(ico_filename), ico_id)
RuntimeError: MapExistingFile: The handle is invalid.
Has anybody really been able to set the icon for the executable
generated by py2exe?