[Tutor] Problem with converting Python to EXE using py2exe

Alan Gauld alan.gauld at btinternet.com
Sat Apr 11 14:51:41 CEST 2009


"Dave Angel" <davea at ieee.org> wrote

>> To use a relative path base = pic(file=root+"/base.gif")
> <snip...>
>
> I would get 'root' this way, rather than requiring anything to be set up 
> by the install  (registry, environment vars, config):

Good idea, I forgot that in Python you can find the full path that way.
Too used to working in C/C++ where the file macro only gives the
filename...

> (Does anybody think that using __file__ this way is uncool?   For 
> example, should I better use  sys.path[0] ?  Or something more convoluted 
> involving sys.modules ?)

No I think __file__ is good for this.

Alan G. 




More information about the Tutor mailing list