Search code examples
pythonrobotframework

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

  • 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