问题
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