[PATCH 05 of 52 Narval cube] [new style] use new except syntax

Nsukami Patrick ptrck at nskm.xyz
Wed Apr 1 11:34:05 CEST 2020


# HG changeset patch
# User Nsukami Patrick <ptrck at nskm dot xyz>
# Date 1585406348 0
#      Sat Mar 28 14:39:08 2020 +0000
# Node ID 44a6b4af7297c37a82bae77f9ec6877cdc2146bf
# Parent  e9ac4086dec687e20ae20d68a9cb4e0516200485
[new style] use new except syntax

diff --git a/cubicweb_narval/narvalbot/engine.py b/cubicweb_narval/narvalbot/engine.py
--- a/cubicweb_narval/narvalbot/engine.py
+++ b/cubicweb_narval/narvalbot/engine.py
@@ -101,7 +101,7 @@
         try:
             narvalplan.run()
             narvalplan.fire_transition('end')
-        except RESOURCE_LIMIT_EXCEPTION, ex:
+        except RESOURCE_LIMIT_EXCEPTION as ex:
             self.resource_reached(ex, 'processing plan %s' % narvalplan.url)
             narvalplan.fire_transition('kill')
             raise
diff --git a/cubicweb_narval/narvalbot/server.py b/cubicweb_narval/narvalbot/server.py
--- a/cubicweb_narval/narvalbot/server.py
+++ b/cubicweb_narval/narvalbot/server.py
@@ -105,14 +105,14 @@
                     self.info('get pending plan from %s', instance_id)
                     for plandata in self.config.cnxh(instance_id).pending_plans():
                         self._queue_plan(queue, instance_id, plandata)
-                except Exception, ex:
+                except Exception as ex:
                     self.exception(str(ex))
             try:
                 queue = sorted(queue)
                 self._start_processes(queue)
             except SystemExit:
                 raise
-            except Exception, ex:
+            except Exception as ex:
                 self.exception('error while starting process: %s', ex)
             if not queue:
                 # nothing to do, sleep a bit
@@ -225,7 +225,7 @@
         try:
             # kill possibly remaining children
             os.killpg(cmd.pid, signal.SIGKILL)
-        except OSError, ex:
+        except OSError as ex:
             if ex.errno != errno.ESRCH:
                 raise
         for stream in (outfile, errfile):
diff --git a/cubicweb_narval/testutils.py b/cubicweb_narval/testutils.py
--- a/cubicweb_narval/testutils.py
+++ b/cubicweb_narval/testutils.py
@@ -57,7 +57,7 @@
                 sys.stdout = self.stdout
                 sys.stderr = self.stderr
                 main.run(self.command[1:])
-            except SystemExit, ex:
+            except SystemExit as ex:
                 self.returncode = ex.code
             except:
                 self.returncode = -1
diff --git a/cubicweb_narval/views/startplan.py b/cubicweb_narval/views/startplan.py
--- a/cubicweb_narval/views/startplan.py
+++ b/cubicweb_narval/views/startplan.py
@@ -88,7 +88,7 @@
                 self.cell_call(i, 0, priority=priority)
             except ValidationError:
                 raise
-            except Exception, ex:
+            except Exception as ex:
                 raise Redirect(self.msg_url(unicode(ex)))
         raise Redirect(self.msg_url(self._cw._('plan(s) queued')))
 




More information about the cubicweb-devel mailing list