I can't understand why this ImportError occurs
Hello, I'm using ROS kinetic on Ubuntu 16.04.
I know this issue would be the kind of pure Python, but I really don't know about this kind of error.
I'm working with openai_ros
packages on the Python3 environment and I think I already have the necessary packages.
To use openai_ros
packages, I have to activate a virtual Python3 environment in the specific workspace and let's assume that I have that_custom_module_file.py
and also this has the class that_Class
of class that_class()
in the former workspace.
Of course, that_custom_module_file.py
is not in the directory where python
would be typed, but a deeper place.
I launched
$ python
and imported
$ from .that_custom_module_file import that_Class
but I got this error message:
SystemError: Parent module '' not loaded, cannot perform relative import
and when I typer
$ from that_custom_module_file import that_Class
I got another message:
ImportError: No module named 'that_custom_module_file'
why these errors occur?
Just so you know, openai_ros
is ROS package and that_custom_module_file.py
is just one of the python scripts.
I can
$ import rospy
$ from sensor_msgs,msg import LaserScan
which is not in the place where the command $python
is launched.
what is the difference between these?
Just because of the PATH
setting?
Then can I add the path of the virtual environment for Python3 into the real bashrc
file?
Thanks in advance. :)