'leading zeros in decimal integer literals are not permitted; use an 0o prefix for octal integers

I have a step in Robot Framework to check if duration > 20 minutes then failed.

What to fix when the actual minute is 09 with zero ? no issue if it is 10,11....

error: Evaluating expression '09 > 20' failed: SyntaxError: leading zeros in decimal integer literals are not permitted; use an 0o prefix for octal integers (<string>, line 1)

Test step:

Run Keyword And Continue On Failure    Run Keyword If   ${modelTrainedDuration} > ${minutes}   fail    Model Trained Duration is more than ${minutes} minutes


Solution 1:[1]

use double quotes in a variable, it will solve your problem

Run Keyword And Continue On Failure    Run Keyword If   "${modelTrainedDuration}" > "${minutes}"   fail    Model Trained Duration is more than ${minutes} minutes

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Manish Kumar