[Pythonmac-SIG] appscript rocket-in-dock preventing logout

Bill Janssen janssen at parc.com
Sat Jan 31 00:20:12 CET 2009


We discussed this a bit last year, but with no resolution that I
remember.  I've got a situation where a Python program is preventing
logout/shutdown.  It's a script that just runs in an endless loop
watching what app I'm working with; when it sees one it knows (Preview,
MS Word, Safari, etc.) it uses appscript to ask the app what document
I'm looking at.  It then squirrels that document away in a journal so
that I've got a record of what I've been working with.

The basic control loop is something like this:

   while True:
      ... see what's running, and possibly what document ...
      time.sleep(1.0)

When I fire this up, it creates a Python rocket icon in the dock.  Not
great, but I can live with it.  But it also prevents logout and shutdown
from working -- I keep getting the message "Logout has timed out because
the application Python has failed to quit".

Does anyone know what I've got to do to this script to keep it from
preventing logout?  For bonus points, what do I have to do to keep it
from putting the rocket in the dock?

Bill


More information about the Pythonmac-SIG mailing list