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

Nathaniel Gray n8gray at gmail.com
Sat Oct 2 03:06:49 CEST 2004


On Fri, 1 Oct 2004 14:30:21 -0700, Kevin Altis <altis at semi-retired.com> wrote:

> Hmm, I don't know what the explanation of the #! line not working is,
> but I found the same thing, I had to use /usr/bin/env pythonw to make
> it work as expected. The error message I received is for tcsh since my
> system was upgraded from Jaguar and I never bothered to switch to bash.
> 
> tcsh: import: Command not found.
> from: can't read /var/mail/wx.lib
> tcsh: Badly placed ()'s.

I figured this out.  The problem is that pythonw is a symlink to
pythonw2.3, which is a shell script, and Darwin won't allow the
interpreter for one script to be another script.  I ended up using
this ugly line:
#!/System/Library/Frameworks/Python.framework/Versions/Current/Resources/Python.app/Contents/MacOS/Python

Thankfully, Darwin doesn't seem to mind really long #! lines.  The
proper solution, AFAICT, is to make /usr/bin/pythonw2.3 a symlink to
the mess I listed above rather than a shell script that wraps the mess
I listed above.  This is how /usr/bin/python2.3 works, which is why
#!/usr/bin/python does work (I was mistaken when I reported that it
didn't).

I'm not sure who to file the bug report with.  Can anybody point me in
the right direction?

> As for doing simple dialogs I don't know all the Mac-specific options,
> but wxPython provides all the system dialogs and then some and of
> course it works the same on Linux, Mac OS X, and Windows. The
> dialogs.py module provides function wrappers for all of the dialogs so
> you don't have to worry about creating an instance of the dialog
> classes, showing the dialog, and then destroying it, instead you just
> make a function call which is a nice match for modal dialogs. It would
> be tough to get much simpler than this.

I'm afraid downloading WxPython is too heavyweight.  I'm trying to use
Python as AppleScript, essentially.  I was thrilled to find appscript,
makes it feasible to do exactly that, but I need a simple, lightweight
way to interact with users.  The balance is heavily weighted towards a
solution that is platform-specific and has few (preferably no)
dependencies.  Basically I really want an EasyDialogs that works.  ;^)

Thanks for your help,
-n8

-- 
>>>-- Nathaniel Gray -- Caltech Computer Science ------>
>>>-- Mojave Project -- http://mojave.cs.caltech.edu -->


More information about the Pythonmac-SIG mailing list