[Pythonmac-SIG] clickable Python OSX apps and os.getcwd()

Just van Rossum just at letterror.com
Tue Jul 8 10:39:07 EDT 2003


Bugbee, Larry wrote:

> I agree this is a tough one and I'm not 100% sure what the answer
> should be.  I'm frustrated that when I execute a short commandline
> script on any platform, I get one behavior, and when I run the same
> script by double clicking (after BuildApplet), I get another.  If
> <somepath>/aaa.app is looking for file <somepath>/zzz.txt, why should
> it have to be written differently just because the user moved the
> whole dir  to <someotherpath>?  Subdirs would/should still be
> relative to the app (.app) and findable.
> 
> Perhaps these apps should have awareness of just where they located
> by reading a sys.whereami parameter?  I'm OK with that except for the
> fact pgms written under Linux or Windows won't be written that way. 
> These pgms should run under OSX unaltered, even when BuildApplet
> might be used to make things easier for the Mac user.
> 
> As for the Dock and aliases, I would treat them as aliases.  ...but
> where they point *is* interesting, and my candidate for the working
> dir.
> 
> Another alternative: Perhaps all this could be a specified option in
> BuildApplet?
> 
> I dunno.  I just want cross platform behavior to be as much the same
> as possible.  Is there a way?

I think it's actually a reasonable feature request for BuildApplet (to
set the working dir to the applet's containing folder). It might be an
idea to couple this behavior to the argv emulation code (which
translates dropped items to argv items). A patch would be appreciated.

Just



More information about the Pythonmac-SIG mailing list