[GRASS-SVN] r68138 - grass/trunk/lib/python/pygrass/rpc
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Mar 24 22:22:26 PDT 2016
Author: zarch
Date: 2016-03-24 22:22:25 -0700 (Thu, 24 Mar 2016)
New Revision: 68138
Modified:
grass/trunk/lib/python/pygrass/rpc/base.py
Log:
pygrass: remove old exception style to be compatible with python3
Modified: grass/trunk/lib/python/pygrass/rpc/base.py
===================================================================
--- grass/trunk/lib/python/pygrass/rpc/base.py 2016-03-24 19:15:36 UTC (rev 68137)
+++ grass/trunk/lib/python/pygrass/rpc/base.py 2016-03-25 05:22:25 UTC (rev 68138)
@@ -43,42 +43,42 @@
class RPCServerBase(object):
"""This is the base class for send and receive RPC server
It uses a Pipe for IPC.
-
-
+
+
>>> import grass.script as gscript
>>> from grass.pygrass.rpc.base import RPCServerBase
>>> provider = RPCServerBase()
-
+
>>> provider.is_server_alive()
True
-
+
>>> provider.is_check_thread_alive()
True
>>> provider.stop()
>>> provider.is_server_alive()
False
-
+
>>> provider.is_check_thread_alive()
False
-
+
>>> provider = RPCServerBase()
>>> provider.is_server_alive()
True
>>> provider.is_check_thread_alive()
True
-
+
Kill the server process with an exception, it should restart
-
+
>>> provider.client_conn.send([1])
>>> provider.is_server_alive()
True
-
+
>>> provider.is_check_thread_alive()
True
"""
-
+
def __init__(self):
self.client_conn = None
self.server_conn = None
@@ -89,10 +89,10 @@
self.start_server()
self.start_checker_thread()
self.stopThread = False
-
+
def is_server_alive(self):
return self.server.is_alive()
-
+
def is_check_thread_alive(self):
return self.checkThread.is_alive()
@@ -160,7 +160,7 @@
if isinstance(ret, FatalError):
raise ret
return ret
- except (EOFError, IOError, FatalError), e:
+ except (EOFError, IOError, FatalError) as e:
# The pipe was closed by the checker thread because
# the server process was killed
raise FatalError("Exception raised: " + str(e) + " Message: " + message)
More information about the grass-commit
mailing list