ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
From the Python docs
When a module named
spam
is imported, the interpreter first searches for a built-in module with that name. If not found, it then searches for a file namedspam.py
in a list of directories given by the variablesys.path
.sys.path
is initialized from these locations:
- the directory containing the input script (or the current directory).
PYTHONPATH
(a list of directory names, with the same syntax as the shell variablePATH
).- the installation-dependent default.
After initialization, Python programs can modify
sys.path
. The directory containing the script being run is placed at the beginning of the search path, ahead of the standard library path. This means that scripts in that directory will be loaded instead of modules of the same name in the library directory. This is an error unless the replacement is intended. See section Standard Modules for more information.
In other words, the Python interpreter doesn't know where to look for your module. It looks in the directory in which your calling it from the directory in which the calling file lives (your robot_motion_control
package), then after it doesn't find it there then it looks in your PYTHONPATH
, then the installation-dependent default. The zeroborg_support
package is in none of these paths. Therefore, it throws an ImportError
saying it can't find the module that you're trying to import.
Checkout the catkin docs to see how to install Python scripts and modules.
2 | No.2 Revision |
From the Python docs
When a module named
spam
is imported, the interpreter first searches for a built-in module with that name. If not found, it then searches for a file namedspam.py
in a list of directories given by the variablesys.path
.sys.path
is initialized from these locations:
- the directory containing the input script (or the current directory).
PYTHONPATH
(a list of directory names, with the same syntax as the shell variablePATH
).- the installation-dependent default.
After initialization, Python programs can modify
sys.path
. The directory containing the script being run is placed at the beginning of the search path, ahead of the standard library path. This means that scripts in that directory will be loaded instead of modules of the same name in the library directory. This is an error unless the replacement is intended. See section Standard Modules for more information.
In other words, the Python interpreter doesn't know where to look for your module. It looks in the directory in which your calling it from the directory in which the calling file lives (your robot_motion_control
package), then after it doesn't find it there then it looks in your PYTHONPATH
, then the installation-dependent default. The zeroborg_support
package is in none of these paths. Therefore, it throws an ImportError
saying it can't find the module that you're trying to import.
Checkout the catkin docs to see how to install Python scripts and modules.