The only way to use variables in the argument file using the syntax --variablefile filename.py:arg1:arg2 is to have your variable file implement the get_variables function. This function will be passed by the arguments specified on the command line and should return a dictionary of variable names and values.
For example, consider the following variable file called "variables.py":
def get_variables(arg1, arg2): variables = {"argument 1": arg1, "argument 2": arg2, } return variables
This file creates two robot variables named ${argument 1} and ${argument 2} . The values โโfor these variables will be the values โโof the arguments that were passed. You can use this variable file as follows:
pybot --variablefile variables.py:one:two ...
In this case, the strings โoneโ and โtwoโ will be passed to get_variables as two arguments. Then they will be associated with two variables, as a result of which ${argument 1} set to one and ${argument 2} to two .
source share