Reputation: 21
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
Upvotes: 0
Views: 2495
Reputation: 5472
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
Upvotes: 1
Reputation: 385970
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')
Upvotes: 1