"It prints 10" doesn't tell you anything about what type it is. It's probably the string "10"
and not the number 10
-- as you might guess from the method name getString
. You can't divide a string by a number. Try doing:
chance = int(self.cfg.getString("main.candydropchance"))