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

Any Ideas what could be causing this error from a launch file? - TCPROS [closed]

asked 2022-12-07 14:22:26 -0600

chased11 gravatar image

updated 2022-12-08 01:52:41 -0600

gvdhoorn gravatar image

I am converting the ros-trimble-bd960 package to read from a socket rather than serial port. I thought this was pretty straight forward as they read the same type of data but I just needed to change a few things in the code. I can upload what i have to a github repo if needed. I have tested the socket stream away from ROS and had no problems. I know this error is apparently something wrong with my python setup but would like some direction. Running both launch files gives the same error:

Traceback (most recent call last):
  File "/home/user/catkin_ws/src/ros-trimble-bd960/scripts/gps.py", line 3, in <module>
    import rospy
  File "/opt/ros/noetic/lib/python3/dist-packages/rospy/__init__.py", line 49, in <module>
    from .client import spin, myargv, init_node, \
  File "/opt/ros/noetic/lib/python3/dist-packages/rospy/client.py", line 60, in <module>
    import rospy.impl.init
  File "/opt/ros/noetic/lib/python3/dist-packages/rospy/impl/init.py", line 54, in <module>
    from .tcpros import init_tcpros
  File "/opt/ros/noetic/lib/python3/dist-packages/rospy/impl/tcpros.py", line 45, in <module>
    import rospy.impl.tcpros_service
  File "/opt/ros/noetic/lib/python3/dist-packages/rospy/impl/tcpros_service.py", line 54, in <module>
    from rospy.impl.tcpros_base import TCPROSTransport, TCPROSTransportProtocol, \
  File "/opt/ros/noetic/lib/python3/dist-packages/rospy/impl/tcpros_base.py", line 167
    (e_errno, msg, *_) = e.args
                   ^
SyntaxError: invalid syntax
[gps-2] process has died [pid 13458, exit code 1, cmd /home/chase/catkin_ws/src/ros-trimble-bd960/scripts/gps.py __name:=gps __log:=/home/user/.ros/log/4dde074c-766b-11ed-978b-f7fbe9041b00/gps-2.log].
log file: /home/chase/.ros/log/4dde074c-766b-11ed-978b-f7fbe9041b00/gps-2*.log
edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by chased11
close date 2022-12-12 14:58:16.435710

Comments

Which Ubuntu do you have? If 20.04, you can install python-is-python3 package to use Python 3.x as default one

ljaniec gravatar image ljaniec  ( 2022-12-11 18:19:56 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2022-12-07 16:45:56 -0600

Mike Scheutzow gravatar image

This is a python2 vs. python3 mismatch. My guess that you are invoking the python2 interpreter, which is not supported by noetic.

One small step to avoiding these kind of issues to make sure that /usr/bin/python is a symlink to python3, not python2.

edit flag offensive delete link more

Comments

Yep that was the problem/ Fix was starting the scripts with #! /usr/bin/python3. The package I installed was using python 2.

chased11 gravatar image chased11  ( 2022-12-12 14:57:04 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2022-12-07 14:22:26 -0600

Seen: 179 times

Last updated: Dec 08 '22