一、问题描述

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

相关文章:

  • 2021-06-11
  • 2022-12-23
  • 2022-12-23
  • 2021-05-02
  • 2021-06-13
  • 2021-06-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-05-29
  • 2021-11-13
  • 2021-09-15
  • 2022-12-23
  • 2022-12-23
  • 2021-04-23
  • 2021-11-02
相关资源
相似解决方案