Preben Randhol wrote:
> Hi
> 
> If I do:
> 
> try:
>       import pygtk
>       pygtk.require("2.0")
> except:
>       pass
> 
> then sys.path[0] will point towards 
> /usr/lib/python2.4/site-packages/gtk-2.0
> in stead of the script. Is this expected behavior?

Yes, I think.  require() above changes sys.path so that correct GTK+
version (2.0 in your case) is loaded.

> If so is there an alternative to sys.path[0] except from catching it
> before doing pygtk.require. Do one need to do this at all by the way?

There is no alternative I think.  But most of the time you don't need
to worry.  If you do, however, better copy it to some meaningfully
named variable like

        path_to_application = sys.path[0]

before doing anything else.

Paul
_______________________________________________
pygtk mailing list   [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to