[wxPython-users] Problem packaging with py2exe

Robin Dunn robin at alldunn.com
Thu Jun 21 15:03:58 PDT 2007


Werner F. Bruhin wrote:
>> Also, the program has a .ico file that is used for the app's icon and 
>> for the taskbar icons. It is placed in the same location in the exe, 
>> but when the program starts, I get an error dialog with the message:
>> Can't load image from file c-get.ico: file does not exist.
>>   
> Try this:
> icon_resources = [(1, r"c-get.ico")],

That will take care of embedding it in the exe so it is used for file 
listings in Windows Explorer and what-not, but you'll still want to have 
a way to find it at runtime so you can use it for self.SetIcon and etc. 
  When you say it is placed in the same location as the exe it sounds 
like you are assuming that it will automatically be found there if you 
don't specify a path name.  That is not the case, it will only be found 
that way if the app happens to be running with that dir as the current 
working dir, which you can't guarantee.  Best thing to do is to use one 
of the dirs provided by wx.StandardPaths, but you can also use something 
like os.path.dirname(sys.argv[0]) to find where the image file is located.

-- 
Robin Dunn
Software Craftsman
http://wxPython.org  Java give you jitters?  Relax with wxPython!





More information about the wxpython-users mailing list