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.

1

1 Answer

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.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

You Might Also Like