gpsd-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gpsd-dev] [PATCH 05/12] Fixes a client.py exception for Python 3.


From: Fred Wright
Subject: [gpsd-dev] [PATCH 05/12] Fixes a client.py exception for Python 3.
Date: Fri, 8 Apr 2016 10:07:46 -0700

In Python 3, exception objects are local to the try/except block,
making them inaccessible outside that block.  It was probably actually
an error to set the "message" to be the exception object rather than
its string representation, anyway.

TESTED:
Ran xgps without gpsd running, and verified that the proper error box
is displayed, in both Python 2 and Python 3 (with appropriate builds
of the extensions).
---
 gps/client.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gps/client.py b/gps/client.py
index ec9d100..cdc5059 100644
--- a/gps/client.py
+++ b/gps/client.py
@@ -67,7 +67,8 @@ class gpscommon:
                 self.sock = socket.socket(af, socktype, proto)
                 # if self.debuglevel > 0: print 'connect:', (host, port)
                 self.sock.connect(sa)
-            except socket.error as msg:
+            except socket.error as e:
+                msg = str(e)
                 # if self.debuglevel > 0: print 'connect fail:', (host, port)
                 self.close()
                 continue
-- 
2.8.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]