tags:

views:

135

answers:

1

When attempting to load the iTunes XML/plist file, I get "internal table overflow." After Googling, it looks like Applescript has run out of memory. The file is 18 meg on disk, so while on the larger side of things, it should still work on a Mac with 2 gigs.

How can I resolve this?

Obviously, since it's created by iTunes, I can't control the generate of it much.

Update: The relevant snippet:

tell application "System Events"
    tell property list file (itunes_xml_file as string)
        tell contents
            set my_tracks to value of property list item "Tracks"
            repeat with t in items of my_tracks
+1  A: 

I guess that AppleScript is simply not made to handle this amount of data. I tried to use AppleScript a while back as well and tried to do something similar (reading an iTunes library). AppleScript's original intention was to automate applications by sending AppleEvents to them - which in combination with the weird syntax of AppleScript, confuses a lot and makes it difficult to do a lot of simple things.

After some frustrating time I decided to use Python instead, as it provides a simple module for reading the plist files: http://docs.python.org/dev/library/plistlib.html

Possibly not what you wanted to hear, but the problem with AppleScript is that it is easily overloaded with data, as the abstraction of data it works with is rather bulky and takes up lot of memory.

I'm sure if you give Python a try, you'll have something up and running in less than a hour. Python is installed on all Macs by default and is really easy to learn.

BastiBense
Additionally, if you need to do what AppleScript does, you can use the Python module appscript (http://appscript.sourceforge.net/) to do the same things from Python; I've not used the Python version, but I have used the Ruby version, and it's quite good.
Antal S-Z
Thanks. If nobody can really answer how to do it this way, I'll take a look at switching to Python as Plan B.
Bill