0
$\begingroup$

Rosanswers logo

Hey i'm new in ROS. I've been tried to launch moveit! roslaunch moveit_setup_assistant setup_assistant.launch i'd got these error "SyntaxError: invalid syntax ". These are my traceback:

Traceback (most recent call last):
  File "/opt/ros/melodic/bin/roslaunch", line 34, in <module>
    import roslaunch
  File "/opt/ros/melodic/lib/python2.7/dist-packages/roslaunch/__init__.py", line 62, in <module>
    from .scriptapi import ROSLaunch
  File "/opt/ros/melodic/lib/python2.7/dist-packages/roslaunch/scriptapi.py", line 42, in <module>
    import roslaunch.parent
  File "/opt/ros/melodic/lib/python2.7/dist-packages/roslaunch/parent.py", line 54, in <module>
    import roslaunch.server
  File "/opt/ros/melodic/lib/python2.7/dist-packages/roslaunch/server.py", line 79, in <module>
    from rosgraph_msgs.msg import Log
  File "/opt/ros/dashing/lib/python3.6/site-packages/rosgraph_msgs/msg/__init__.py", line 1, in <module>
    from rosgraph_msgs.msg._clock import Clock  # noqa: F401
  File "/opt/ros/dashing/lib/python3.6/site-packages/rosgraph_msgs/msg/_clock.py", line 56
    class Clock(metaclass = Metaclass_Clock):
                          ^
SyntaxError: invalid syntax

And these might be related error but i've feel doesn't help :https://answers.ros.org/question/221035/ros-scripts-and-python-related-error/ Please I need help, and anybody have suggestion ?


Originally posted by Augustine_Sena on ROS Answers with karma: 1 on 2020-03-18

Post score: 0

$\endgroup$

2 Answers 2

0
$\begingroup$

Rosanswers logo

We see this:

File "/opt/ros/melodic/bin/roslaunch",

and:

File "/opt/ros/dashing/lib/python3.6

which suggests you have both ROS 1 Melodic and ROS 2 Dashing installed on your machine.

Moreover, you probably also have both ROS versions sourced in the same shell. Do you have two source /opt/ros/.../setup.bash lines in your .bashrc by any chance?

If so, remove the one for ROS 2 for now and see whether things start working.


Originally posted by gvdhoorn with karma: 86574 on 2020-03-18

This answer was NOT ACCEPTED on the original site

Post score: 1

$\endgroup$
0
$\begingroup$

Rosanswers logo

It is probably because you are running ROS under python 2.7 and in your code you are using Python 3 syntax for metaclass definition. So i would say there is a mixure of Python versions.


Originally posted by sbambula with karma: 11 on 2020-03-18

This answer was NOT ACCEPTED on the original site

Post score: 1


Original comments

Comment by gvdhoorn on 2020-03-18:
The traceback makes reference to ROS Dashing, which is a ROS 2 version which makes use of Python 3. So that would be expected.

What the OP needs to do is sort out in which order he sources things, and/or whether he even needs to source both ROS versions at the same time.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.