← Back to team overview

sikuli-driver team mailing list archive

[Question #203087]: os.system not working calling sikuli scripts from the command prompt

 

New question #203087 on Sikuli:
https://answers.launchpad.net/sikuli/+question/203087

Im trying to make a basic function to glob all of my sikuli scripts and run them in order. This is to make a standard main for a testing framework. 

While this isn't necessarily a sikuli syntax issue, it is an issue with calling sikuli from the command prompt. 

My script relies on os.system to call the functions. But the same exact string that I type into the cmd prompt that works there does not work with os.system. Heres the important syntax (I have the correct imports not shown)

files = glob.glob('./tests/*.sikuli')
if len(files) is 0:
    raise TestHelper.TestError('ERROR: no test files found')
for xfile in files:
    logging.debug('Running test: ' + str(xfile[1:]))
    os.system('"C:/Program Files/Sikuli X/Sikuli-IDE.exe" -r ' + '"' + os.getcwd()+ xfile[1:] + '"')

To step you through my code, here is whats going on. 

It goes to the tests/ directory and finds all folders with .sikuli
This gets put into a list called files. 
We do a quick check if there are files in this list, if not, toss a custom error. 
then we loop through the list of files, getting a single file per time through.
We log whats going on
Then we call os.system to call sikuli via the command prompt. The code inside of the parenthesis gives the following output:
"C:/Program Files/Sikuli X/Sikuli-IDE-w.bat" -r "C:\MY_DIRECTORIES\SikTest/tests\CPRS Testing.sikuli"

You will notice the different \ after DIRECTORIES and before SikTest. This however does not cause an issue doing it manually and is needed for glob to work. 

So I guess what I am asking is whether anyone else has experienced problems using os.system to call a sikuli script via the method described to call it via the command prompt, and if anyone has a workaround or can tell me what I am doing wrong. 

Thanks


-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.