Reputation: 1
I'm doing a school project about changing my wallpaper from python and it works in the terminal perfectly but I need to do it from my text editor, atom, and it doesn't seem to work. I've tried rearranging the apostrophes as maybe it's that, but can't seem to make it work.
This works on the terminal perfectly:
osascript -e 'tell application "System Events" to set picture of every desktop to ("/Users/carlaa/Desktop/DEVf/python/APODkata/apodimage.jpg" as POSIX file as alias)'
but from atom in says invalid syntax
from subprocess import call
subprocess.call(["osascript -e 'tell application "System Events" to set picture of every desktop to ("/Users/carlaa/Desktop/DEVf/python/APODkata/apodimage.jpg" as POSIX file as alias)'",shell=True])
Upvotes: 0
Views: 365
Reputation: 3382
You need to escape those double quotes and remove subprocess
:
from subprocess import call
call(["osascript -e 'tell application \"System Events\" to set picture of every desktop to (\"/Users/carlaa/Desktop/DEVf/python/APODkata/apodimage.jpg\" as POSIX file as alias)'", shell=True])
Upvotes: 1