ros-infrastructure / rosdoc_lite

A light-weight version of rosdoc that does not rely on ROS infrastructure for crawling packages.
10 stars 31 forks source link

AttributeError: 'module' object has no attribute 'parse_package' (in latest rosdoc_late) #76

Closed CodeFinder2 closed 7 years ago

CodeFinder2 commented 7 years ago

Hi all,

when I am running rosdoc_lite (latest version as of 08 Jun 17), I get:

$ rosdoc_lite /opt/ros/kinetic/share/rviz Traceback (most recent call last): File "/opt/ros/kinetic/bin/rosdoc_lite", line 37, in rosdoc_lite.main() File "/opt/ros/kinetic/lib/python2.7/dist-packages/rosdoc_lite/init.py", line 225, in main pkg_desc = get_pkg_desc(path) File "/opt/ros/kinetic/lib/python2.7/dist-packages/rosdoc_lite/init.py", line 241, in get_pkg_desc pkg_desc = packages.parse_package(path) AttributeError: 'module' object has no attribute 'parse_package'

The package path provided as argument doesn't matter -- it happens with all tested packages (pure Python and pure C++).

The error can be fixed by patching /opt/ros/kinetic/lib/python2.7/dist-packages/rosdoc_lite/init.py (replacing from catkin_pkg import packages with from catkin_pkg import package as well as pkg_desc = packages.parse_package(path) with pkg_desc = package.parse_package(path)). However, modifying system packages / files isn't a good idea. ;-)

Also note the following:

$ python
Python 2.7.12 (default, Nov 19 2016, 06:48:10) 
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import catkin_pkg.package
>>> dir(catkin_pkg.package)
['Dependency', 'Export', 'InvalidPackage', 'PACKAGE_MANIFEST_FILENAME', 'Package', 'Person', 'Url', '__builtins__', '__doc__', '__file__', '__name__', '__package__', '_get_dependencies', '_get_node', '_get_node_attr', '_get_node_value', '_get_nodes', '_get_optional_node', '_get_optional_node_value', '_get_package_xml', 'deepcopy', 'dom', 'os', 'package_exists_at', 'parse_package', 'parse_package_for_distutils', 'parse_package_string', 'print_function', 're', 'sys']
>>> import catkin_pkg.packages
>>> dir(catkin_pkg.packages)
['PACKAGE_MANIFEST_FILENAME', '_PackageParser', '__builtins__', '__doc__', '__file__', '__name__', '__package__', '_get_package_xml', 'find_package_paths', 'find_packages', 'find_packages_allowing_duplicates', 'multiprocessing', 'os', 'parse_package_string', 'verify_equal_package_versions']

Anyone else having this issue? (I am using ROS Kinetic.)

jack-oquin commented 7 years ago

@dirk-thomas: does this proposed change work with Indigo too? Or, do we require a separate Kinetic branch?

dirk-thomas commented 7 years ago

@CodeFinder2 The problem has already been fixed in #74. Please install the latest version (0.2.7) which includes the fix.

@jack-oquin The Python package catkin_pkg is released independently of ROS distributions. Therefore it doesn't require different handling within rosdoc_lite.

CodeFinder2 commented 7 years ago

Thanks and sorry for the noise (haven't seen #74)!