python不使用shell脚本执行

2024-09-30 18:27:53 发布

您现在位置:Python中文网/ 问答频道 /正文

我在Anki矢量机器人上通过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”中的自定义文本响应_亚历克西斯.py和股票“你好世界”从教程。当launchd调用它时,会删除.txt文件,但python脚本都不会执行。 系统为MacOS 10.14.2。Z在MacOS中报告为非法选项。在所有文件中使用-@lscom.apple.com. 用于删除。chmod使所有文件都可执行。还是没有快乐。看看控制台,我得到了这些报告 2月5日08:01:56 MacBFancher苹果公司.launchd[1](舞蹈):服务只运行了3秒钟。把重生推出来7秒。 2月5日08:05:40 MacBFancher苹果公司.launchd[1](苹果基金会.IMRemoteURLConnectionAgent):整数的未知键:\u dirtyjetsamemeryLimit


Tags: 文件py脚本hellosdkshellexamplesusers