Skip to content

[BUG]ModuleNotFoundError Due to Relative Import #14

@acoderofpku

Description

@acoderofpku

Bug Description

When running the command python3 ./examples/demo2/ranger.py, a ModuleNotFoundError occurs, indicating that the node module cannot be found.

Component

  • Brain (AI/LLM)
  • Capability (Hardware interface)
  • Driver (Hardware driver)
  • Manager (System bootstrap)
  • Memory (Knowledge storage)
  • Simulator (Genesis simulation)
  • Skill (Behavioral logic)
  • UAPI (User programming interface)

Steps to Reproduce

1.Run the command:
python3 ./examples/demo2/ranger.py
2.Observe the traceback error below

Expected Behavior

The program should run successfully, loading all necessary modules, and proceed with execution.

Environment

  • OS: Ubuntu 22.04
  • ROS2 Version: Humble
  • Python Version:3.10.12

Error Logs

─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ /home/rui/Desktop/Robot/robonix/./examples/demo2/ranger.py:19 in <module>                        │
│                                                                                                  │
│    16 from robonix.uapi import get_runtime, set_runtime                                          │
│    17 from robonix.manager.log import logger, set_log_level                                      │
│    18                                                                                            │
│ ❱  19 from robonix.skill import *                                                                │
│    20                                                                                            │
│    21 set_log_level("debug")                                                                     │
│    22                                                                                            │
│                                                                                                  │
│ /home/rui/Desktop/Robot/robonix/robonix/skill/__init__.py:3 in <module>                          │
│                                                                                                  │
│    1 # Auto-generated by @eaios.api                                                              │
│    2 __all__ = ["cap_camera_dep_rgb", "cap_camera_info", "cap_camera_rgb",                       │
│      "cap_pointcloud_to_file", "cap_tf_transform", "get_pose", "move_to_ab_pos",                 │
│      "move_to_goal", "move_to_rel_pos", "nv_test", "set_goal", "simple_set_goal",                │
│      "skl_add_map_obj", "skl_detect_objs", "skl_query_map", "skl_query_map_all",                 │
│      "skl_update_map", "stop_goal", "test_nv"]                                                   │
│ ❱  3 from robonix.capability.navigation2.api.api import nv_test                                  │
│    4 from robonix.capability.navigation2.api.api import set_goal                                 │
│    5 from robonix.capability.navigation2.api.api import simple_set_goal                          │
│    6 from robonix.capability.navigation2.api.api import stop_goal                                │
│                                                                                                  │
│ /home/rui/Desktop/Robot/robonix/robonix/capability/navigation2/api/api.py:18 in <module>         │
│                                                                                                  │
│    15 from sensor_msgs.msg import Range                                                          │
│    16 import sys                                                                                 │
│    17                                                                                            │
│ ❱  18 from robonix.manager.eaios_decorators import eaios                                         │
│    19                                                                                            │
│    20 def quaternion_from_euler(                                                                 │
│    21 │   roll: float,                                                                           │
│                                                                                                  │
│ /home/rui/Desktop/Robot/robonix/robonix/manager/eaios_decorators.py:10 in <module>               │
│                                                                                                  │
│     7 import yaml                                                                                │
│     8 import sys                                                                                 │
│     9 import inspect                                                                             │
│ ❱  10 from node import get_entry_name                                                            │
│    11                                                                                            │
│    12 if os.path.abspath(os.path.dirname(__file__)) not in sys.path:                             │
│    13 │   sys.path.append(os.path.abspath(os.path.dirname(__file__)))                            │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
ModuleNotFoundError: No module named 'node'

Additional Context

The error indicates that the system cannot find the node module. This issue appears to be related to the import structure, specifically the line from node import get_entry_name, which fails to locate the node module in the current path.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions