Ask Your Question
1

How to define a python version for ROS

asked 2019-11-29 07:24:21 -0600

goszjacek gravatar image

I try to run the teleop node using cmd:

rosrun turtlebot3_teleop turtlebot3_teleop_key

But I get an error

  File "/home/goszjacek/catkin_ws/src/turtlebot3/turtlebot3_teleop/nodes/turtlebot3_teleop_key", line 140
    print msg
            ^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(msg)?

Python path is set to:

/home/goszjacek/catkin_ws/devel/lib/python2.7/dist-packages:/opt/ros/melodic/lib/python2.7/dist-packages

But anyway ROS tries to run the turtlebot3_teleop_key with python3. How can I force ROS to use 2.7, or can I change it in the settings?

edit retag flag offensive close merge delete

Comments

Always add your ROS Distro to your question to get more directed answer. Because ROS Kinetic supports only python 2.7 but there are ways to compile it with different version.

Gokul gravatar imageGokul ( 2019-11-30 16:29:21 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2019-11-30 16:33:07 -0600

Gokul gravatar image

You can use this command

catkin build --cmake-args -DPYTHON_VERSION=2.7

For further reference, you can try out different solution posted here for this question

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2019-11-29 07:24:21 -0600

Seen: 32 times

Last updated: Nov 30