2017-05-04 2 views
0

나는 벽지를 파이썬에서 바꾸는 것에 관한 학교 프로젝트를하고 있는데, 터미널에서 완벽하게 작동하지만 필자의 텍스트 편집기, 원자에서 할 필요가있다. 작동하지 않는 것 같다. 내가 아포스트로피를 재 배열하려고 시도했을 수도 있지만 그럴 수는 없다. 터미널에서 명령을 원자화하는 방법?

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)' 

만의 원자에서

말한다 잘못된 구문 당신은 그 따옴표를 탈출 subprocess 제거해야

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]) 
+1

내놔

이 완벽 터미널에서 작동 [슈퍼 유저] (https://superuser.com/)에서 시도해보십시오 ... – PrR3

답변

1

:

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]) 
+0

고마워요! 비록 내가 잘못된 구문을 받고 계속. – Carla

+0

@Carla 정확한 오류로 질문을 업데이트하고 원자보다는 터미널에서 파이썬 스크립트를 실행 해 보시겠습니까? –

관련 문제