pythongoogle-chromesafarisourceforge-appscriptpy-appscript

Bouncing Python Application in Mac Dock when Accessing URLs with py-appscript


This has been a recurring, strange issue for me when accessing URLs using py-appscript, first in Safari and now in Chrome.

Whenever I run the script command to get the current URL in the terminal, for example,

appscript.app("Google Chrome").windows.active_tab.URL()

a bouncing instance of the "Python" application appears in the Dock. I have verified that this "Python" application is found in:

/Library/Frameworks/Python.framework/Versions/2.6/Resources

How do I get the current URL without this thing popping up?


Solution

  • The background on this problem is explained here by the author of appscript. Assuming you are on OS X 10.5 or higher, the solution is to use a Python that has been built using a minimum deployment target of 10.5 or higher. From the path you supplied, it appears likely you are using a Python 2.6 from a python.org installer. Traditionally, python.org Pythons are built to run on multiple versions from 10.3 on up and so appscript running under it will show this problem. Starting with Python 2.7 (and additionally soon with Python 3.2), python.org is providing a second installer variant, one that only runs on OS X 10.6 or higher. Those variants should not have the bouncing icon problem. Other options are to install a Python 2.6 using MacPorts, Fink, or HomeBrew or build it yourself (a little tricky to get all the batteries included). Or, if you are on OS X 10.6, you can use the Python 2.6 supplied by Apple in /usr/bin.