views:

24

answers:

1

i have a py2app application, which runs an appscript using py-appscript. the Applescript code is this one line:

app('Finder').update(<file alias of a certain file>)

What this normally does is update a file's preview in Finder. It works most of the time, except for Leopard. In Leopard, everytime that script is executed, instead of updating the file, it starts a new instance of Finder. What am I doing wrong? The app was built on the same machine (the Leopard).

+1  A: 

Seeing as how py-appscript is a layer between python and the application you are scripting via Applescript, I would suggest porting the statement to pure Applescript and see if it works there. There are a lot of things that can go wrong with Applescript (and your statement alone) to begin with and it's not obvious what is the expected before with py-appscript when an error occurs.

Philip Regan
not the answer, but your suggestion pointed me in the right direction. i tried running it in AppleScript and it reproduces the problem! checked the logs, and realized that there were multiple users logged in. Applescript was accessing the Finder instance with the lower process ID value (thereby giving me a "Permission denied" error). I modified the script to specify the user's Finder instance through its process ID, and it's working fine now. The weird thing is it only happens in Leopard.
maranas
I know it wasn't a proper answer, I really didn't have one, but I hoped my suggestion would lead you down the right path. A lot of stuff changed with Applescript with Leopard and some things changed again with Snow Leopard, but I've never been able to find what exactly those changes were. Such is the life of an Applescripter. Cheers
Philip Regan