1

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?

TheMaster
  • 45,448
  • 6
  • 62
  • 85
Chris Redford
  • 16,982
  • 21
  • 89
  • 109

1 Answers1

3

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.

Ned Deily
  • 83,389
  • 16
  • 128
  • 151
  • Installing the latest Python from python.org specifically for 10.6 or later and/or changing the Python installation to use for the script to `#!/usr/bin/python` worked (since I tried the latter after installing the former, I'm not sure if both were necessary). Thanks Ned! – Chris Redford Dec 21 '10 at 14:10
  • If you have changed to `/usr/bin/python`, you are using the Apple-supplied Python so you don't need the python.org Python in that case. – Ned Deily Dec 21 '10 at 18:29