Apple event handler error (Python / AppScript)
I wrote the following simple python script to change the desktop wallpaper on my mac (based on this thread ):
from appscript import app, mactypes
import sys
fileName = sys.argv[1:]
app('Finder').desktop_picture.set(mactypes.File(fileName))
However, when I run it, I get the following output:
Traceback (last call last):
File "../Source/SetWallPaper2.py", line 6, to the application ('Finder'). desktop_picture.set (mactypes.File (Filename)) file "/Library/Python/2.5/site-packages/appscript-0.19.0-py2.5-macosx-10.5-i386.egg/appscript/reference.py", line 513, to the call to appscript.reference.CommandError: Command failed: OSERROR: -10000 MESSAGE: Apple event handler failed. COMMAND: app (and '/System/Library/CoreServices/Finder.app'). desktop_picture.set (mactypes.File (U "/ Users / Daniel / Photos / ['test.jpg']"))
I have done some web searches but I cannot find anything to help me understand what OSERROR -10000 means or how to solve the problem.
a source to share
In the above, what would be the format for copying one file to another folder?
It's kind of like an application ("Finder"). copy (mactypes.File (u "/Users/Daniel/Pictures/ ['test.jpg ']")) to_folder (mactypes.File (u "/ Users / Daniel / OLD_PIX /))
Thanks for the help, Frank