Reputation: 139
I am trying to run a cmd script which calls a setenv.py
file. This file has a function which says,
import build_cfg
tool_versions = get_tool_versions()
env_var_list = get_env_var()
which I believe is importing the build_cfg
module.
build_cfg
in turn has get_tool_versions
and get_env_vars
functions defined.
Anyway, when I run my script I get an error :
File "setenv.py", line 172, in <module>
tool_versions = get_tool_versions ()
NameError: name 'get_tool_versions' is not defined
I am relatively new to python. Could you please tell me what I am doing wrong?
Upvotes: 0
Views: 1887
Reputation: 716
The error message says it all: The function get_tool_versions
does not exist in the global namespace.
To solve this problem you have to find out where get_tool_versions
is defined and import it from there. If it is defined in build_cfg
you can do it like this:
import build_cfg
tool_versions = build_cfg.get_tool_versions()
...
or
from build_cfg import get_tool_versions
tool_versions = get_tool_versions()
...
Upvotes: 2