mil
mil copied to clipboard
Relative import causes `ImportError` with `mil_usb_to_can` executables in Noetic
In the mil_usb_to_can
module, using relative imports causes the executable to fail. For example, this:
# mil_usb_to_can/driver.py
from .board import USBtoCANBoard
from .utils import USB2CANException
causes this ImportError
when using rosrun mil_usb_to_can driver.py
:
Traceback (most recent call last):
File "/home/user/catkin_ws/src/mil/mil_common/drivers/mil_usb_to_can/mil_usb_to_can/driver.py", line 8, in <module>
from .board import USBtoCANBoard
ImportError: attempted relative import with no known parent package
Currently, we will just use absolute imports. However, we need to explore why this issue occurs, and how we can move back to relative imports for increased brevity.