ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

SyntaxError: invalid syntax during launching move_it

asked 2020-03-18 00:24:59 -0600

Augustine_Sena gravatar image

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/", line 62, in <module>
    from .scriptapi import ROSLaunch
  File "/opt/ros/melodic/lib/python2.7/dist-packages/roslaunch/", line 42, in <module>
    import roslaunch.parent
  File "/opt/ros/melodic/lib/python2.7/dist-packages/roslaunch/", line 54, in <module>
    import roslaunch.server
  File "/opt/ros/melodic/lib/python2.7/dist-packages/roslaunch/", line 79, in <module>
    from rosgraph_msgs.msg import Log
  File "/opt/ros/dashing/lib/python3.6/site-packages/rosgraph_msgs/msg/", 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/", line 56
    class Clock(metaclass = Metaclass_Clock):
SyntaxError: invalid syntax

And these might be related error but i've feel doesn't help : Please I need help, and anybody have suggestion ?

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted

answered 2020-03-18 03:34:04 -0600

gvdhoorn gravatar image

updated 2020-03-18 04:48:41 -0600

We see this:

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


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.

edit flag offensive delete link more

answered 2020-03-18 04:40:23 -0600

sbambula gravatar image

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.

edit flag offensive delete link more


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.

gvdhoorn gravatar image gvdhoorn  ( 2020-03-18 04:48:33 -0600 )edit

Question Tools

1 follower


Asked: 2020-03-18 00:24:59 -0600

Seen: 1,232 times

Last updated: Mar 18 '20