Fixing my scripting environment for Snow Leopard

So far, things are going well with Snow Leopard. No crashes, and all the programs I use regularly have been running fine. I had to do a little work to get my Python utility scripts running, and I had delete some AppleScript Scripting Additions that were throwing error messages.

Leopard used Python 2.5; Snow Leopard uses 2.6. All the nonstandard modules I installed under Leopard were been saved in /Library/Python/2.5/site-packages/, but Python 2.6, of course, looks in /Library/Python/2.6/site-packages instead. Clark of Clark’s Tech Blog had a post about this a few weeks ago. He did the responsible thing and did clean new installs of all the modules he uses. I tried something lazier: copying everything from 2.5/site-packages/ into 2.6/site-packages and then deleting all the .pyc files (The second step was done in case there was a change in the byte-compiled file format between 2.5 and 2.6. New .pyc files get generated automatically when the modules are called.) I had suggested this as a simple alternative in a comment to Clark’s post.

For the most part, my quick and dirty solution worked, but that’s because most of the modules I use are pure Python. Modules that use compiled C code, like appscript, are likely to fail if they’re “installed” this way. Better to use easy_install or download the code and do python setup.py install. You’ll need to install XCode 3.2 (comes on the Snow Leopard installer DVD) first, so the correct version of gcc is available.

The AppleScript Scripting Additions I had to get rid of were from the free Smile environment from Satimage. Although my AppleScripts were all running fine, they were also generating all kinds of error messages of the form:

Error loading /Library/ScriptingAdditions/Numerics.osax/Contents/MacOS/Numerics:  
dlopen(/Library/ScriptingAdditions/Numerics.osax/Contents/MacOS/Numerics, 262):
no suitable image found.  Did find:
/Library/ScriptingAdditions/Numerics.osax/Contents/MacOS/Numerics:
no matching architecture in universal wrapper
osascript: OpenScripting.framework - scripting addition
"/Library/ScriptingAdditions/Numerics.osax" declares no loadable handlers.

For most AppleScripts, these messages were going into system log files and weren’t any bother. But some of my AppleScripts are run from the command line (or are called by other scripts that are run from the command line) and in these cases the error messages were filling up the Terminal. Deleting the offending Scripting Additions—which aren’t used in any of my regular AppleScripts—solved the problem.

Tags: