[Pythonmac-SIG] py2app and CLI Python programs

Bob Ippolito bob at redivi.com
Tue May 10 19:28:11 CEST 2005


On May 10, 2005, at 11:29 AM, Robert Kern wrote:

> David Reed wrote:
>
>> I've got a command line Python app that I tried packaging up with
>> py2app. It worked ok - t could cd into the subdir of the .app
>> containing the executable and run it from the command line, but I'm
>> not certain what its current working directory was since when I tried
>> to specify a file on the command line, it didn't find it. I had to
>> specify the full path to the file to make it work. Is there a simple
>> workaround for command line versions - I didn't see anything in the
>> documentation.
>>
>
> [/some/path] $ /Applications/MyApp.app/Contents/MacOS/MyApp
>
> will usually have /some/path as the cwd.
>
> However, .app bundles are probably not what you want for CLI apps.

py2app will chdir to /Applications/MyApp.app/Contents/Resources by  
default, if you specify the --no-chdir option, it will not change the  
directory (but when started by LaunchServices, the cwd will be /).

py2app is the only reliable way to create standalone Python  
applications on Mac OS X.. it might make sense to write a CLI app  
with it and throw some symlinks into /usr/local/bin or something..  
but you're probably better off just giving them the script and  
telling them how to get the dependencies.  Most people comfortable at  
a CLI are going to be able to do that.

-bob



More information about the Pythonmac-SIG mailing list