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

Bugbee, Larry larry.bugbee at boeing.com
Mon Jul 7 19:48:46 EDT 2003


	> However, when you double click apps created by BuildApplet and
	> Platypus, the initial working directory is / and not the dir from which
	> it was launched.

	What is the dir form which it was launched??? That is not a clearly
	defined concept. The Icon that is being clicked on could b anywhere: in
	the dock, an alias on the desktop, in /usr/local/bin, in /Applications.
	etc.

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?

                      --frustrated







More information about the Pythonmac-SIG mailing list