ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

ROS 2 custom message build error "abc" package

asked 2019-11-18 11:07:33 -0600

Hello,

I am testing creation of custom message packages in ROS 2 with colcon tools.
I have 2 test packages:

  1. abc/MyMsg.msg - custom message package named "abc" that contains a message "MyMsg.msg"
  2. use_abc_msg/UseMyMsg.msg - custom message package named "use_abc_msgs" contains a message "UseMyMsg.msg" that refers to "abc/MyMsg".

I get strange python errors when building this simple hierarchy of custom message packages. Errors are shown below:

Starting >>> abc
[Processing: abc]
Finished <<< abc [38.7s]
Starting >>> use_abc_msgs
--- stderr: use_abc_msgs
Fatal Python error: init_sys_streams: can't initialize sys standard streams
Traceback (most recent call last):
  File "C:\Python37\lib\io.py", line 72, in <module>
**AttributeError: module 'abc' has no attribute 'ABCMeta'**
CMake Error at C:/dev/ros2/share/ament_cmake_core/cmake/ament_cmake_package_templates-extras.cmake:41 (message):
  execute_process(C:/Python37/python.exe
  C:/dev/ros2/share/ament_cmake_core/cmake/package_templates/templates_2_cmake.py
  C:/test/build/use_abc_msgs/ament_cmake_package_templates/templates.cmake)
  **returned error code Exit code 0xc0000409**

Call Stack (most recent call first):
  C:/dev/ros2/share/ament_cmake_core/cmake/ament_cmake_coreConfig.cmake:38 (include)
  C:/dev/ros2/share/ament_cmake/cmake/ament_cmake_export_dependencies-extras.cmake:15 (find_package)
  C:/dev/ros2/share/ament_cmake/cmake/ament_cmakeConfig.cmake:38 (include)
  CMakeLists.txt:19 (find_package)

I don't understand how Python Abstract Base Classes are invoked.

I found a similar posting related to ROS 1 Catkin, but did not see a satisfactory solution.

System environment

Operating System: Windows 10

ROS 2 version: Dashing (built from sources)

CMake version: 3.14.7

Python version: 3.7.2

I have attached the zip archive test_custom_msg.zip that shows this issue:

Reproduction steps:

  1. Extract the zip-archive.
  2. Change folder to the extracted archive.
  3. Run local_setup.bat or setup.bash for ROS 2 (I'm sure this is platform independent).
  4. Run "colcon build --merge-install".

Any guidance will be greatly appreciated.

Thanks.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2019-11-18 15:02:14 -0600

Dirk Thomas gravatar image

Your package name is abc and the Python code generated for the message will end up in the abc namespace. Python already contains a package named abc which it needs to find. Your package collides with that and therefore prevents Python from working.

Hence you should rename your package to something not colliding with Python names (if it contains Python code / messages).

edit flag offensive delete link more

Comments

@Dirk Thomas: would it be possible to check for these sort of collisions ahead of time, so as to avoid late user-facing errors such as the one reported by OP? Python has a list available of builtins and keywords. Same for C++ and other languages.

Checking whether something can be loaded as a module (in Python specifically) should also be possible.

It would enhance the user experience significantly.

gvdhoorn gravatar image gvdhoorn  ( 2019-11-18 15:18:59 -0600 )edit

abc is neither a builtin not a keyword. It is just a Python package distributed with Python as part of the core libraries. It would be great if that case could be catched - any proposals where and how that should happen are very welcome.

Dirk Thomas gravatar image Dirk Thomas  ( 2019-11-18 15:21:39 -0600 )edit

abc is neither a builtin not a keyword. It is just a Python package distributed with Python as part of the core libraries.

I know. But it would be equally beneficial to check for builtins and keywords.

Especially novice users are easily confused by these sorts of errors.

gvdhoorn gravatar image gvdhoorn  ( 2019-11-18 15:29:40 -0600 )edit

Question Tools

2 followers

Stats

Asked: 2019-11-18 11:02:22 -0600

Seen: 841 times

Last updated: Nov 18 '19