Question #156909 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/156909

    Status: Answered => Solved

Anshu confirmed that the question is solved:
Hi RaiMan,
Thanks for all that info and suggestions.

1 .I do use communicate() in my script.Basically i process the output
that i get from sikuli  ( initially needed - to remove the sikuli log
messages , that can be turned off now as of sikuli rc2).So after getting
the value of p ,  i was using BigOutput = p.communicate() to further
process that.

2.What i found the change or the immediate issue from my scripts was that , i 
was using exit(1) in all the failed cases, but for some pass cases , i just did 
not exit with exit(0) necessarily .But once the script finished - with pass 
scenario it automatically returned exit code as 0 and everything worked fine.
Whereas in RC2,it is passing the value of 255 - instead of 0 that was passed 
before.

So the simplest workaround that I did is that instead of checking for 0
return code and marking the case as final pass , i reversed it to check
for 1 , to make sure that it fails for exit code 1.

if p.returncode == 1:
        print 'PYTHON : Testcase Failed'
        CleanUpCode()
        
  else:
        print 'PYTHON :Testcase Succeeded'
        return Retmsg
    


(OR if at the end of each script - i add the statement exit(0) that works too.)
So for now my problem is solved.

***********************************************************************************

As a side note , i would like to add that i had similar problems with
return codes on windows also and they were solved by a surprising
solution that worked.

On windows i was getting the return code of -1 , even if for pass cases.

For sikuli 0.10 , i was calling sikuli scipt using following command - which 
worked fine
p = subprocess.Popen('"C:\Program Files\Sikuli\Sikuli-ide.exe" -r ' + 
finalname, shell=True,stdout=subprocess.PIPE,stderr=subprocess.PIPE)

For Sikuli RC1 , this did not work ( was returning -1 always) .But when i 
launched sikuli using .bat --> it worked.
p = subprocess.Popen('"C:\Program Files\Sikuli X\Sikuli-ide.bat" -r ' + 
finalname, shell=True,stdout=subprocess.PIPE,stderr=subprocess.PIPE)

Then for RC2 , i got the same issue and this time launching by jar command is 
returning proper values.
 p = subprocess.Popen('java -jar "C:\Program Files\Sikuli X\sikuli-script.jar" 
' + finalname, shell=True,stdout=subprocess.PIPE,stderr=subprocess.PIPE)

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

_______________________________________________
Mailing list: https://launchpad.net/~sikuli-driver
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp

Reply via email to