[Pythonmac-SIG] Re: cwd and PythonLauncher problem -- a bit more
info
Chris Barker
Chris.Barker at noaa.gov
Fri Oct 1 19:51:21 CEST 2004
Bob Ippolito wrote:
> GUI apps in
> OS X always have a current directory of /
really? UGG!
> (not sure why you ever saw it
> have a path of the user directory, maybe PythonLauncher does that on
> purpose?). It would make sense for PythonLauncher to behave otherwise
> though.
>
> In the meantime, you could do:
>
> import os
> os.chdir(os.path.dirname(__file__))
>
> which will change to the directory that your script is in.
Is there a reliable way to change it to the user's home directory? can
you count on this?:
import os
os.chdir(os.getenv("HOME"))
this works from a shell, but will HOME be defined in a GUI app?
-Chris
--
Christopher Barker, Ph.D.
Oceanographer
NOAA/OR&R/HAZMAT (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 Pythonmac-SIG
mailing list