一、問題描述
python3 運行類似以下代碼時報錯:AttributeError: module 'applescript' has no attribute 'app'
import applescript
comand = "ls"
applescript.app('Terminal').do_script(comand)
二、解決方案
換成如下代碼執行即可:
from applescript import tell
comand = "ls"
tell.app( 'Terminal', 'do script "' + comand + '"')