"No matching ... overload found Following overloads are available"

Last edited on

Python makes a distinction between numbers and strings, so if you have a number as a string (e.g., “562”), and want to access the value as a number, you must explicitly convert it.

Normally this is easily done using the standard Python syntax i = int(s) where s is a string and i is the number it represents. But if you do this in a Squish test script it won’t work. Instead you’ll get an error message like this:

No matching 'int(str)' overload found: Following overloads are available:
 int::int()
 int::int(int)
 int::int(int *)

Unfortunately, Squish defines its own int() (and type()) function, so the standard Python versions of these functions are not directly available.

It is, of course, possible to access the original standard Python functions by accessing them via the builtin module. This involves explicitly importing the builtin module as follows:

import __builtin__

Now the rest of the script can use Python’s standard int() (and type()) functions by using their fully-qualified names. For example:

s = "562"
i = __builtin__.int(s) # i is an int of value 562

See also https://doc.froglogic.com/squish/latest/all/rgs-py.html.