Diwakar SHARMA
Diwakar SHARMA

Reputation: 581

unable to pass a list from robot framework to python

I need to pass a list from robot framework to python but I am unable to do that .

Kindly help in resolving the issue .

I have tried below mention robot code but it doesn't works :

${list1}= create list  a   b   c
${list2}= create list  d   e   f
cleanup1   ${list1}  ${list2}

python code :

def cleanup1(list1,list2):
    print (list1)
    print (list2)

Please help why is this failing ?

Expected output was to print both the list .

However I am getting error message :

No keyword with name ${list1}= create list found.

Upvotes: 2

Views: 1087

Answers (1)

Bryan Oakley
Bryan Oakley

Reputation: 385970

Robot uses two or more spaces to separate each component of a statement. You only have a single space between ${list1}= and create list. Robot, therefore, thinks that the first cell is ${list1}= create list. It expects to find either a variable or a keyword name in the first cell and it can't find a keyword named ${list1}= create list so it throws the error that you are reporting.

The solution is simple: make sure there are two or more spaces between the variable and the keyword:

${list1}=  create list  a  b  c
         ^^

Upvotes: 4

Related Questions