首页 > 解决方案 > python没有用shell脚本执行

问题描述

我在 Anki Vector 机器人上通过 Alexa 使用 IFTTT。IFTTT 向我的计算机发送一个文本文件,launchd 正在监视该文件夹是否有任何更改。当它检测到更改时,会调用一个 shell 脚本。虽然我可以看到 shell 脚本的其他部分执行,但没有调用 python 脚本。当我从命令行执行 shell 脚本时,它会正确运行并执行两个 python 脚本。

我尝试更改 shell 脚本的权限。我尝试了各种调用 python 脚本的方法。

 #!/bin/bash
 #!/bin/sh
 # My example bash script
 #osascript -e 'tell app "System Events" to display dialog "Hello World"'
 cd /Users/fancher/Development/anki_vector_sdk_examples_0.5.1/tutorials/

 python3 /Users/fancher/Development/anki_vector_sdk_examples_0.5.1/tutorials/01_hello_alexis.py

  python3 /Users/fancher/Development/anki_vector_sdk_examples_0.5.1/tutorials/01_hello_world.py

  sleep 3
  rm -f /Users/fancher/Dropbox/Vector/Test2.txt
  rm -f /Users/fancher/Dropbox/Vector/.DS_Store

  echo success!
  #osascript -e 'tell app "System Events" to display dialog "trap point"'

当我从命令行执行此操作时,它可以工作 - 使用“hello_alexis.py”中的自定义文本和教程中的“hello_world”中的自定义文本进行响应。当它被 launchd 调用时,.txt 文件被删除,但没有执行 python 脚本。系统为 MacOS 10.14.2。Z 在 MacOS 中报告为非法选项。在 ls 中使用 -@ 所有文件都有 com.apple.quarantine。使用 xattr 删除。chmod 使所有可执行文件。仍然没有喜悦。看着控制台,我收到这些报告 2 月 5 日 08:01:56 MacBFancher com.apple.xpc.launchd[1] (com.fancher.Vector_dance.):服务只运行了 3 秒。将重生时间推迟 7 秒。2 月 5 日 08:05:40 MacBFancher com.apple.xpc.launchd[1] (com.apple.imfoundation.IMRemoteURLConnectionAgent):整数的未知键:_DirtyJetsamMemoryLimit

标签: pythonvectordropboxifttt

解决方案


推荐阅读