git-afsantos / haros_tutorials

Example code for a fictitious ROS robot to try out HAROS
MIT License
6 stars 3 forks source link

UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 68: ordinal not in range(128) #7

Open melnarte opened 3 years ago

melnarte commented 3 years ago

Hello, I am not sure that my way to use HAROS is good, but :

  1. I put it directly to my package folder (along with src) cloned folder make-haros-easy and follow the instruction inside
  2. I create project folder with some yaml file and launch

` (harosenv) hugh@hugh-Legion-Y540-15IRH[ecm30] ~/catkin_ws/src/telemetry/qr_telemetry(master) $ ls CMakeLists.txt launch make-haros-easy package.xml projects README.MD src (harosenv) hugh@hugh-Legion-Y540-15IRH[ecm30] ~/catkin_ws/src/telemetry/qr_telemetry(master) $ haros full -s 0.0.0.0:8080 -p projects/minimal.yaml [HAROS] Running setup operations... [HAROS] Loading common definitions... [HAROS] Loading plugins...

Loaded haros_plugin_cccc Loaded haros_plugin_ccd Loaded haros_plugin_cppcheck Loaded haros_plugin_cpplint Loaded haros_plugin_lizard Loaded haros_plugin_mi_calculator Loaded haros_plugin_pbt_gen Loaded haros_plugin_pyflwor Loaded haros_plugin_pylint Loaded haros_plugin_radon [HAROS] Reading project and indexing source code... [HAROS] Check news updates with: $ haros news Traceback (most recent call last): File "/home/hugh/catkin_ws/src/telemetry/qr_telemetry/make-haros-easy/harosenv/bin/haros", line 8, in sys.exit(main()) File "/home/hugh/catkin_ws/src/telemetry/qr_telemetry/make-haros-easy/harosenv/local/lib/python2.7/site-packages/haros/haros.py", line 1055, in main if launcher.launch(argv=argv): File "/home/hugh/catkin_ws/src/telemetry/qr_telemetry/make-haros-easy/harosenv/local/lib/python2.7/site-packages/haros/haros.py", line 194, in launch return command(args) File "/home/hugh/catkin_ws/src/telemetry/qr_telemetry/make-haros-easy/harosenv/local/lib/python2.7/site-packages/haros/haros.py", line 217, in command_full return self.command_analyse(args) and self.command_viz(args) File "/home/hugh/catkin_ws/src/telemetry/qr_telemetry/make-haros-easy/harosenv/local/lib/python2.7/site-packages/haros/haros.py", line 238, in command_analyse return analyse.run() File "/home/hugh/catkin_ws/src/telemetry/qr_telemetry/make-haros-easy/harosenv/local/lib/python2.7/site-packages/haros/haros.py", line 668, in run configs, nodes, env = self._extract_metamodel(node_cache, rules) File "/home/hugh/catkin_ws/src/telemetry/qr_telemetry/make-haros-easy/harosenv/local/lib/python2.7/site-packages/haros/haros.py", line 699, in _extract_metamodel extractor.index_source(settings = self.settings) File "/home/hugh/catkin_ws/src/telemetry/qr_telemetry/make-haros-easy/harosenv/local/lib/python2.7/site-packages/haros/extractor.py", line 180, in index_source self._populate_packages_and_dependencies(settings=settings) File "/home/hugh/catkin_ws/src/telemetry/qr_telemetry/make-haros-easy/harosenv/local/lib/python2.7/site-packages/haros/extractor.py", line 303, in _populate_packages_and_dependencies pkg, ignored_globs=settings.ignored_globs) File "/home/hugh/catkin_ws/src/telemetry/qr_telemetry/make-haros-easy/harosenv/local/lib/python2.7/site-packages/haros/extractor.py", line 796, in _populate_package ignore = source.set_file_stats() File "/home/hugh/catkin_ws/src/telemetry/qr_telemetry/make-haros-easy/harosenv/local/lib/python2.7/site-packages/haros/metamodel.py", line 746, in set_file_stats if ilp(sline): File "/home/hugh/catkin_ws/src/telemetry/qr_telemetry/make-haros-easy/harosenv/local/lib/python2.7/site-packages/haros/metamodel.py", line 2070, in _cpp_ignore_line return "// haros:ignore-line" in line UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 68: ordinal not in range(128) `

Using Docker, this shell command also gives an error ` hugh@hugh-Legion-Y540-15IRH[ecm30] ~/catkin_ws/src/telemetry/qr_telemetry(master) $ haros full -s 0.0.0.0:8080 -p projects/minimal.yaml [HAROS] Running setup operations... [HAROS] Loading common definitions... [HAROS] Loading plugins...

Loaded haros_plugin_cccc Loaded haros_plugin_ccd Loaded haros_plugin_cppcheck Loaded haros_plugin_cpplint Loaded haros_plugin_lizard Loaded haros_plugin_mi_calculator Loaded haros_plugin_pylint Loaded haros_plugin_radon [HAROS] Reading project and indexing source code... [HAROS] Check news updates with: $ haros news Traceback (most recent call last): File "/home/hugh/.local/bin/haros", line 11, in sys.exit(main()) File "/home/hugh/.local/lib/python2.7/site-packages/haros/haros.py", line 1055, in main if launcher.launch(argv=argv): File "/home/hugh/.local/lib/python2.7/site-packages/haros/haros.py", line 194, in launch return command(args) File "/home/hugh/.local/lib/python2.7/site-packages/haros/haros.py", line 217, in command_full return self.command_analyse(args) and self.command_viz(args) File "/home/hugh/.local/lib/python2.7/site-packages/haros/haros.py", line 238, in command_analyse return analyse.run() File "/home/hugh/.local/lib/python2.7/site-packages/haros/haros.py", line 668, in run configs, nodes, env = self._extract_metamodel(node_cache, rules) File "/home/hugh/.local/lib/python2.7/site-packages/haros/haros.py", line 699, in _extract_metamodel extractor.index_source(settings = self.settings) File "/home/hugh/.local/lib/python2.7/site-packages/haros/extractor.py", line 180, in index_source self._populate_packages_and_dependencies(settings=settings) File "/home/hugh/.local/lib/python2.7/site-packages/haros/extractor.py", line 303, in _populate_packages_and_dependencies pkg, ignored_globs=settings.ignored_globs) File "/home/hugh/.local/lib/python2.7/site-packages/haros/extractor.py", line 796, in _populate_package ignore = source.set_file_stats() File "/home/hugh/.local/lib/python2.7/site-packages/haros/metamodel.py", line 746, in set_file_stats if ilp(sline): File "/home/hugh/.local/lib/python2.7/site-packages/haros/metamodel.py", line 2070, in _cpp_ignore_line return "// haros:ignore-line" in line UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 68: ordinal not in range(128)

`

git-afsantos commented 3 years ago

Hello, Artem. Thanks for reporting the error!

Placing HAROS within a package might cause trouble (but not the error you are seeing). I think it will try to scan its own files, as if it was part of the package. I might have to add a clause for it to ignore itself in the future.

I see that you have a virtual environment within make-haros-easy. Just to be sure, try cutting and pasting the top level make-haros-easy directory outside any packages. Maybe within the workspace, but outside of src, for example.

As for the error, I think it is trying to open a file with non-ASCII characters in it in ASCII mode. It should be easy to fix, if that is the case. I will try to get to it tomorrow, or Monday at the latest.

git-afsantos commented 3 years ago

@melnarte I have published a new version that should avoid this error. Please update to v3.10.16 and let me know.

If you installed via pip, you can run

pip install --upgrade haros