urdf ImportError: No module named 're'
When I tried to typing as follow, to make my first urdf file:
rosrun xacro xacro.py `rospack find pr2_description`/robots/pr2.urdf.xacro -o /tmp/pr2.urdf
I got an error as follow:
Traceback (most recent call last):
File "/opt/ros/kinetic/share/xacro/xacro.py", line 55, in <module>
import xacro
File "/opt/ros/kinetic/lib/python2.7/dist-packages/xacro/__init__.py", line 39, in <module>
import re
File "/usr/lib/python3.5/re.py", line 123, in <module>
import sre_compile
ImportError: No module named 'sre_compile'
Error in sys.excepthook:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 53, in apport_excepthook
if not enabled():
File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 24, in enabled
import re
ImportError: No module named 're'
Original exception was:
Traceback (most recent call last):
File "/opt/ros/kinetic/share/xacro/xacro.py", line 55, in <module>
import xacro
File "/opt/ros/kinetic/lib/python2.7/dist-packages/xacro/__init__.py", line 39, in <module>
import re
File "/usr/lib/python3.5/re.py", line 123, in <module>
import sre_compile
ImportError: No module named 'sre_compile'
I think it is because import re
call the python3, but I don't know how to fix it to call python2 to import re.
So, please tell me how to solve the problem?
Asked by joonhyup on 2019-07-02 01:11:31 UTC
Comments
Do you have Python 3 set as your default interpreter?
Asked by gvdhoorn on 2019-07-02 02:33:58 UTC
No, my default python interpreter is python 2.7.12. When I type 'python' on terminal python 2.7.12 is started.
Asked by joonhyup on 2019-07-03 00:43:22 UTC
Is re installed for python 2?
Asked by AndreasLydakis on 2019-07-11 03:33:34 UTC