[Pythonmac-SIG] Using getwcd() in a frozen app

Christopher Barker Chris.Barker at noaa.gov
Wed Apr 22 01:34:04 CEST 2009


Smith, Jeff wrote:
> I am using py2app 0.3.6 on Mac OX 10.5 and after I freeze a simple 
> command line tool, os.getcwd() returns the location where the 
> application binary lives and not the directory the application is run 
> from.  Is there expected behavior

Yes. The idea is that with a GUI app, the working dir is poorly defined, 
so this can be useful.

> and if so, is there a workaround for this?

Hmmm. Py2app really isn't designed for command line apps -- how are you 
launching it?

But in any case, it looks like this option may do what you want:


--no-chdir (-C)         do not change to the data directory
                         (Contents/Resources) [forced for plugins]


I found that here:

http://svn.pythonmac.org/py2app/py2app/trunk/doc/index.html#option-reference

-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 Pythonmac-SIG mailing list