Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unicode strings with encoding declaration are not supported. #1472

Closed
dvogureckiy99 opened this issue Apr 4, 2023 · 1 comment
Closed

Unicode strings with encoding declaration are not supported. #1472

dvogureckiy99 opened this issue Apr 4, 2023 · 1 comment

Comments

@dvogureckiy99
Copy link

I use :

  • ubuntu 20.04
  • ros 2 humble

Error appeared after command ros2 run gazebo_ros spawn_entity.py -entity solo12dof_quadruped -file ~/git/robot_programming_course/catkin_ws/src/solo12dof_quadruped/urdf/solo12dof_quadruped.urdf -x 0 -y 0 -z 1:

[INFO] [1680612612.664726268] [spawn_entity]: Spawn Entity started
[INFO] [1680612612.665737877] [spawn_entity]: Loading entity XML from file /home/dvogureckiy99/git/robot_programming_course/catkin_ws/src/solo12dof_quadruped/urdf/solo12dof_quadruped.urdf
Traceback (most recent call last):
  File "/home/dvogureckiy99/gazebo_ros_pkgs_ws/install/gazebo_ros/lib/gazebo_ros/spawn_entity.py", line 370, in <module>
    main()
  File "/home/dvogureckiy99/gazebo_ros_pkgs_ws/install/gazebo_ros/lib/gazebo_ros/spawn_entity.py", line 365, in main
    exit_code = spawn_entity_node.run()
  File "/home/dvogureckiy99/gazebo_ros_pkgs_ws/install/gazebo_ros/lib/gazebo_ros/spawn_entity.py", line 192, in run
    xml_parsed = ElementTree.fromstring(entity_xml)
  File "src/lxml/etree.pyx", line 3235, in lxml.etree.fromstring
  File "src/lxml/parser.pxi", line 1871, in lxml.etree._parseMemoryDocument
ValueError: Unicode strings with encoding declaration are not supported. Please use bytes input or XML fragments without declaration.
[ros2run]: Process exited with failure 1
@dvogureckiy99
Copy link
Author

Thanks to chatgpt I solve this problem by adding on line 192 file's ~/gazebo_ros_pkgs_ws/src/gazebo_ros_pkgs/gazebo_ros/scripts/spawn_entity.py:
entity_xml_bytes = entity_xml.encode('utf-8')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant