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

Torben Hohn torben.hohn at linutronix.de
Fri Dec 15 17:15:24 CET 2017


On Mon, Dec 11, 2017 at 10:11:07AM +0100, Manuel Traut wrote:
> in python3 the as keyword is needed to retrieve the value of
> an exception, this also works in python2.

stops working with python2.5 though.
But thats is probably ok nowadays. lets leave that behind.

> Signed-off-by: Manuel Traut <manut at linutronix.de>

Reviewed-by: Torben Hohn <torben.hohn 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
> 
> 
> _______________________________________________
> elbe-devel mailing list
> elbe-devel at linutronix.de
> https://lists.linutronix.de/mailman/listinfo/elbe-devel

-- 
Mit freundlichen Grüßen
Torben Hohn

Linutronix GmbH

Standort: Bremen

Phone: +49 7556 25 999 18; Fax.: +49 7556 25 999 99

Firmensitz / Registered Office: D-88690 Uhldingen, Bahnhofstr. 3
Registergericht / Local District Court: Amtsgericht Freiburg i. Br.; HRB
Nr. / Trade register no.: 700 806

Geschäftsführer / Managing Directors: Heinz Egger, Thomas Gleixner

Eine Bitte von uns: Sollten Sie diese E-Mail irrtümlich erhalten haben,
benachrichtigen Sie uns in diesem Falle bitte sobald wie es Ihnen
möglich ist, durch Antwort-Mail. Vielen Dank!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: Digital signature
URL: <http://lists.linutronix.de/pipermail/elbe-devel/attachments/20171215/02f0dab8/attachment.sig>


More information about the elbe-devel mailing list