[elbe-devel] [PATCH 15/25] py3: fixup exceptions

Manuel Traut manut at linutronix.de
Fri Dec 1 16:51:12 CET 2017


in python3 the as keyword is needed to retrieve the value of
an exception, this also works in python2.

Signed-off-by: Manuel Traut <manut at linutronix.de>
---
 elbepack/commands/init.py | 4 ++--
 elbepack/updated.py       | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/elbepack/commands/init.py b/elbepack/commands/init.py
index 245bc8fe..fdad0246 100644
--- a/elbepack/commands/init.py
+++ b/elbepack/commands/init.py
@@ -125,14 +125,14 @@ def run_command( argv ):
 
     try:
         os.makedirs(path)
-    except OSError, e:
+    except OSError as e:
         print 'unable to create project directory: %s (%s)' % (path, e.strerror)
         sys.exit(30)
 
     out_path = os.path.join(path,".elbe-in")
     try:
         os.makedirs(out_path)
-    except OSError, e:
+    except OSError as e:
         print 'unable to create subdirectory: %s (%s)' % (out_path, e.strerror)
         sys.exit(30)
 
diff --git a/elbepack/updated.py b/elbepack/updated.py
index 3364c593..5e5dc9c2 100644
--- a/elbepack/updated.py
+++ b/elbepack/updated.py
@@ -133,8 +133,8 @@ class UpdateService (ServiceBase):
 
         try:
             apply_update (fname, self.app.status)
-        except Exception, err:
             print Exception, err
+        except Exception as err:
             self.app.status.set_finished ('error')
             return "apply snapshot %s failed" % version
 
@@ -505,7 +505,7 @@ def action_select (upd_file, status):
     if os.path.isdir (prefix + "repo"):
         try:
             update_sourceslist (xml, prefix + "repo", status)
-        except Exception, err:
+        except Exception as err:
             status.log (str (err))
             status.set_finished ('error')
             status.log ("update apt sources list failed: " + prefix)
@@ -513,7 +513,7 @@ def action_select (upd_file, status):
 
         try:
             apply_update ("/tmp/new.xml", status)
-        except Exception, err:
+        except Exception as err:
             status.log (str (err))
             status.set_finished ('error')
             status.log ("apply update failed: " + prefix)
-- 
2.15.1




More information about the elbe-devel mailing list