From 021782fe17b9160ff311c031cab422386b477f36 Mon Sep 17 00:00:00 2001
From: Florent Lamiraux <florent@laas.fr>
Date: Fri, 26 Nov 2021 10:44:07 +0000
Subject: [PATCH] Compatibility with python3.

---
 scripts/run_command | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/scripts/run_command b/scripts/run_command
index d1c8f1a..593b83a 100755
--- a/scripts/run_command
+++ b/scripts/run_command
@@ -67,12 +67,12 @@ class RosShell(InteractiveConsole):
                         return self.runcode(code, False)
                 response = self.client(str(source))
                 if response.standardoutput != "":
-                    print response.standardoutput[:-1]
+                    print(response.standardoutput[:-1])
                 if response.standarderror != "":
-                    print response.standarderror[:-1]
+                    print(response.standarderror[:-1])
                 elif response.result != "None":
-                    print response.result
-            except rospy.ServiceException, e:
+                    print(response.result)
+            except rospy.ServiceException as e:
                 print("Connection to remote server lost. Reconnecting...")
                 self.client = rospy.ServiceProxy(
                     'run_command', dynamic_graph_bridge_msgs.srv.RunCommand, True)
@@ -88,7 +88,11 @@ class RosShell(InteractiveConsole):
                 return self.runcode(c)
             else:
                 return True
-        except SyntaxError, OverflowError:
+        except SyntaxError:
+            self.showsyntaxerror()
+            self.cache = ""
+            return False
+        except OverflowError:
             self.showsyntaxerror()
             self.cache = ""
             return False
-- 
GitLab