universal_robot ROS package学习时:
在xml类文件(urdf,xacro等)中,添加中文注释后,roslaunch运行出现以下报错;
解决办法:
在目录/opt/ros/kinetic/lib/python2.7/dist-packages下,新建一个sitecustomize.py文件,内容为:
#coding=utf8
import sys
reload(sys)
sys.setdefaultencoding('utf8')
重启ROS,发现Python解释器的编码已被设置为utf8;这是因为系统在Python启动的时候,自行调用该文件,设置系统的默认编码。
参考:https://www.tuicool.com/articles/qiqi2i