Hacks: Articles about programming in Python, Perl, PHP, and whatever else I happen to feel like hacking at.

Automator problems with custom Python

Jerry Stratton, May 21, 2007

I thought I’d implement this simple drag-and-drop PDF combiner at the office today, only to discover that it didn’t work. I made a simpler one: just the two steps “combine PDF” and “open in preview”. I noticed that the files were being created but were empty. In the console app I found the following error:

It was interesting to see that at least some Automator functionality is programmed in Python.

My problem was that, at the office, I updated Python from the 2.3 that comes with Mac OS X 10.4 to 2.4, and then I made 2.4 the default (linked /usr/bin/python to /usr/local/bin/python2.4). However, the way Python works is that libraries are installed on a per-version basis. So 2.4 had no idea where to import the core graphics library.

I switched the default Python back to 2.3 and the Automator app began working as expected.

Automator is a simple workflow system for Mac OS X. By its nature it is very procedural: one task follows another; workflows don’t loop and they don’t store variables for later. However, this is possible in Automator and while it adds complexities it can also solve problems such as wanting to save dropped filenames for later use.

Blogroll

Keep in touch

About Mimsy

Comments?

The undiscovered comment form, whose bourn no poster returns.

Your comment

Your name

Your email

Your web page

Your location

Your email, URL, and location are optional—but I won’t be able to contact you if you don’t leave a working email. Your email does not get displayed, your URL and location do. Your name is required but may vary as the needs of the day demand, or you can just use the anonymous Hark Thrice name. You can use the following tags: <em>, <a>, <blockquote>. Use them wisely and post intelligently. Comments may take some time to approve, especially if I’m stuck in a Mexican jail.