← Back to team overview

sikuli-driver team mailing list archive

[Question #688770]: Division not working in Sikuli with Python

 

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

I'm trying to divide 2 numbers in Python. When I do this within Sikuli the results keeps being 0. Whereas when I do this in Pycharm I get the expected result. Can anybody help me please. I'm a bit stuck.

Code:

            tot_words = '9'
            tot_found = '5'
            
            tot_words=int(tot_words)
            tot_found=int(tot_found)
            
            if tot_words == 0:
                print('xxxx found_factor = 0')
                found_factor = 0
            else:
                found_factor = tot_found/tot_words
                print('yyyyy found_factor > 0')
                print('tot_found: ' + str(tot_found))
                print('tot_words: ' + str(tot_words))
            
            print('found_factor1: ' + str(found_factor))


Result in Sikuli IDE NOT as expected

yyyyy found_factor > 0
tot_found: 5
tot_words: 9
found_factor1: 0

Result in Pycharm is as expected:

yyyyy found_factor > 0
tot_found: 5
tot_words: 9
found_factor1: 0.5555555555555556

Process finished with exit code 0

Can somebody explain the difference. That would be very  much appreciated





-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.