SikuliX Bat file not running in Py Script

China☆狼群 提交于 2019-12-12 04:20:09

问题


I have a .Bat file that executes a sikuliX command that refuses to launch from inside my Py Code. (All my other .Bat files work without issues)

This is the code it is in:

os.system("start cmd /k C:\\Blah\\Bla\\Documents\\Folder\\SikuliXTest.bat")

My other Bat files use this same structure and no problems but this guy refuses to launch yet works fine when running independently. It appears it is launching it in some form due to the error output below:

File "C:\Users\Blah\Folder\Folder\GalaxyNote3.sikuli\GalaxyNote3.py", line 14, in click(Pattern("1495231593542.png").similar(0.90)) NameError: name 'click' is not defined

But why is it not executing the same as if I run the Bat directly? Am I missing something?


回答1:


You need to import sikuli library in your python code. Also, jython interpreter needs to be set up giving your sikuli jar path

1) To import sikuli library

from sikuli import *

2) To setup jython interpreter and sikuli, you'll need to use these settings in your pycharm editor settings



来源:https://stackoverflow.com/questions/44080589/sikulix-bat-file-not-running-in-py-script

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!