[Pythonmac-SIG] python + code double-clickable .app bundle?

Just van Rossum just@letterror.com
Sun, 22 Dec 2002 23:00:53 +0100


Ivan Kozik wrote:

> I am trying to combine the python interpreter and a python source
> code file into a .app bundle on Mac OS X 10.2. The only way I know of
> starting it now is: open -a python code.py (which is obviously not a
> good solution).
> 
[ ... ]
> My question is, is there any way to run the python program in a .app
> bundle without an argument to the source code? (and have the mac os x
> windowing manager properly recognize my window)?

I think there are two solutions here. One is to change the extension of
your main program to ".pyw" and run it with PythonLauncher (Jack should
know more details). The other is to build an app bundle with a new tool
that's currently only available from the Python CVS tree (yet works with
Python 2.2 also), called bundlebuilder.py:

http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/*checkout*/python/python/
dist/src/Mac/Lib/bundlebuilder.py?rev=HEAD&content-type=text/x-python

It needs one extra support module, plistlib.py:

http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/*checkout*/python/python/
dist/src/Mac/Lib/plistlib.py?rev=HEAD&content-type=text/x-python

Note that bundlebuilder.py is both a module you can use from Python as
well as a command line program (start with the --help option).

Additionally, if you install modulefinder.py from Tools/freeze/ from a
source distro (or from CVS, like above), bundlebuilder can also build
standalone apps, independent from a Python install. (There are plans to
move modulefinder.py to the stdlib, I hope this still happens before 2.3
gets released.)

Just