[Pythonmac-SIG] #! line and simple dialogs [SOLVED]

Nicholas Riley njriley at uiuc.edu
Sat Oct 2 17:42:30 CEST 2004


On Fri, Oct 01, 2004 at 10:02:21PM -0400, Tom Pollard wrote:
> 
> On Oct 1, 2004, at 9:50 PM, Bob Ippolito wrote:
> >You shouldn't really be using bare scripts as GUI applications in the 
> >first place.
> 
> Why do say that?

OS X doesn't know how to deal with such things, in general.  GUI
(Carbon/Cocoa) applications should be applications, or at least
packaged as such, otherwise a lot of stuff breaks.  For example, an
app needs an icon and a name in the dock, and in the menu bar; what if
someone chooses "Show in Finder"?  What kind of documents could the
script open?

None of these items can be synthesized without either Info.plist or
resource ('BNDL'/owner/'plst') based.  py2app is very simple to use,
and can produce small, self-contained script applications.  Or if you
just want a one-off thing for your own use, try pythonw, but realize
it's getting all this information from Python.app.

This is really no different from AppleScript - scripts must be saved
as applets before they can be double-clicked.  Otherwise, scripts
typically run in another application's context, for example that of
the Script Editor.  AppleScript explicitly prohibits use of the GUI
from the command line:

% osascript -e 'display dialog "foo"'
0:20: execution error: No user interaction allowed. (-1713)

-- 
=Nicholas Riley <njriley at uiuc.edu> | <http://www.uiuc.edu/ph/www/njriley>


More information about the Pythonmac-SIG mailing list