Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

We get the following error in Robot Framework "Keyword 'OperatingSystem.Create File' got positional argument after named arguments"

The below robot framework keywords were used in one of our test cases:

${data_dict}=    Create Dictionary    apiproxy    ${APIPROXY}    request_verb    ${REQUEST_VERB}    basepath    **${basepath}**    pathsuffix    **${pathsuffix}**  

${data_file}=    generate data    ${data_dict}  

Create File    test.sh    content=${QPID_COMMAND}  ${QPID} -org ${ORG} -env ${ENVIRONMENT} -exchange ${exch_name} -queue ${queue_name} -useProtoBuf -noOfMessages  ${msg_count} -batchsize 1 -config ${data_file}  

Here the value of ${basepath}:

${basepath} = ${EMPTY} and ${pathsuffix} = /testpath/

When I try to run this, the error "Keyword 'OperatingSystem.Create File' got positional argument after named arguments" is displayed. I was not able to access the Robot framework Docs.

like image 519
Deepti K Avatar asked Oct 16 '25 17:10

Deepti K


1 Answers

What the error literally means is that you can't put named arguments (eg: x=y) before positional arguments. In the code you show in your question you are giving the keyword a named argument of content=${QPID_COMMAND} followed by another argument that begins with ${QPID}.

Could it be that you have a typo, and that there shouldn't be two spaces between those two? Robot is seeing those two spaces before ${QPID} as a column separator, so it thinks ${QPID} is a separate argument rather than as part of the content.

like image 128
Bryan Oakley Avatar answered Oct 19 '25 07:10

Bryan Oakley



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!