0

I would like to construct a variable for RobotFramework within the variable file but using the Linux environmental variable. Could you advise on the syntax please ?? My current attempts with this:

vif_vlan       = "110"

path_scripts   = '%{MY_DIR}/my_path/scripts'

remote_path    = "/home/mcast/mgen"

end up in not expanding the env variable %{MY_DIR} ...

Tx

2 Answers 2

1

Environment variables are in the environ dictionary of the os module:

import os
path_scripts = os.path.join(os.environ['MY_DIR']', 'my_path', 'scripts')
Sign up to request clarification or add additional context in comments.

Comments

1

Your syntax is almost correct - Not for Python, but for Robot Framework. In your .robot files, you can retrieve environment variables as follows:

** Variables **
| ${MY_PATH_TO_SCRIPTS} | %{MY_DIR}/my_path/scripts

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.