简体   繁体   English

在Sikuli脚本中执行外部Python程序

[英]Executing external Python program in Sikuli script

I am trying to call a python program which just sends me a text on my phone from a Sikuli script.I am a beginner and my goal is to receive a text when a certain loop is finished, but I don't know how to call on it from the Sikuli script. 我正在尝试调用一个python程序,该程序只是通过Sikuli脚本通过手机向我发送文本。我是初学者,我的目标是在特定循环结束后接收文本,但我不知道如何调用可以从Sikuli脚本中获取。 This is a small part of my code from Sikuli so far. 到目前为止,这只是我的Sikuli代码的一小部分。

while (something):
     if (randomThing):
       something = False


subprocess.Popen("python SendSMS.py")

I get an OS error saying no such file or directory. 我收到操作系统错误,提示没有此类文件或目录。 Is there a better way to do this? 有一个更好的方法吗? or what am I doing wrong here? 还是我在这里做错了什么? I am using Mac. 我正在使用Mac。

subprocess.Popen() will look for SendSMS.py in same directory but if your script is not in that directory you will get find not found error which is totally expected. subprocess.Popen subprocess.Popen()将在同一目录中查找SendSMS.py,但是如果您的脚本不在该目录中,则会出现找不到找不到错误的错误,这是完全可以预期的。 As a fix you will need to provide whole path to your script instead of just python SendSMS.py replace it with python /home/my_user/SendSMS.py and check if it works. 作为修复,您将需要提供脚本的完整路径,而不仅是python SendSMS.py ,请用python /home/my_user/SendSMS.py替换它,并检查其是否有效。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM