[Tutor] Problem with converting Python to EXE using py2exe
Alan Gauld
alan.gauld at btinternet.com
Sat Apr 11 01:55:36 CEST 2009
"Chris Lee" <i-scream_cones at hotmail.com> wrote
> _tkinter.TclError: Couldn't open "base.gif": no such file or directory
> ... I linked an image to the python file, but the exe can't find it..
> (right?)
Correct
> base = pic(file="base.gif")
> Now, I'm just wondering... for the "base.gif" part, would it be better
> to write out the whole directory?
No because that requires that your user install the program and
other files exactly where you did. Thats not friendly. Instead use
a relative path, for example keep the images in a sub-directory
of your project and have a registry setting or config file or
environment variable specify where that directory is. You can
then read the config data at startup and use that to create
the path for the image.
--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/
More information about the Tutor
mailing list