Working with artwork in iTunes - problem encountered.

Hey all.

I’m currently working on some scripts to manage my streaming radio station. One of the things I’m working on is a script that extracts the artwork of the currently playing track and saves it to a jpeg file. This seems fairly straight forward, but I continuously get a “Network file permission error” when running the script I have made. This error occurs no matter where I try to write the jpeg file - in /tmp, in my home directory, my desktop… it doesn’t matter. The only “network file system” on my Mac is a AFS volume mounted out of the way on /afs.

Here’s the condensed code that I am working with:


tell application "iTunes"
	set artworkData to (data of artwork 1 of current track) as picture
	set fp to (open for access file "/Users/daleg/Desktop/trackart.jpg" with write permission)
	write artworkData starting at 0 to fp as picture
	close access fp
end tell

It compiles in Script Editor without error, but the aforementioned error still keeps popping up whenever I run it. Any helpful pointers?

TIA,
/dale