[wxPython-users] sys.path adjusted?

Christopher Barker Chris.Barker at noaa.gov
Mon Nov 12 11:14:38 PST 2007


Jorgen Bodde wrote:
>  if it is an unwritten rule that the
> insert should go at the beginning (beats me why) then I will keep this
> construction.

It's not so much that the insert is an unwritten rule, it's that 
sys.path is not designed to tell you where your script is installed. It 
may happen to work most of the time but that's not what it's for.

Indeed, people often want to know at runtime where their program is 
installed, and it turns out that it is a very difficult problem to solve 
in a robust and cross platform way, so the usual advise is -- don't try. 
Use another way to define where you're apps data or whatever is.

On Windows, it's a pretty common convention to store data with the app, 
and with some googling you can find out how to do that (there may be 
something built into wx).

On *nix, there are just oo many options, so don't do that. The tradition 
is to set an environment variable with a startup script or something.

On OS-X, put stuff in the *.app bundle, if you're using one, otherwise, 
treat it like *nix.

Check out wx.StandardPaths to help out with this sort of thing.

-Chris



-- 
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker at noaa.gov




More information about the wxpython-users mailing list