diff options
author | Fabio Erculiani <lxnay@sabayon.org> | 2011-10-09 13:06:00 +0200 |
---|---|---|
committer | Fabio Erculiani <lxnay@sabayon.org> | 2011-10-09 13:06:40 +0200 |
commit | d041bb2d725ce21099acd4175999d8eb8af6b838 (patch) | |
tree | b38b668883b08ae0fee6985c898070b1c9266946 /lib | |
parent | de285e72bc7ed2be2c17a3c42906e1a56cad8255 (diff) |
python: update exception code syntax, make it work with both Python2 and Python3
Diffstat (limited to 'lib')
-rw-r--r-- | lib/python/packagekit/backend.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/python/packagekit/backend.py b/lib/python/packagekit/backend.py index ae7bbadd..fcf2fc9d 100644 --- a/lib/python/packagekit/backend.py +++ b/lib/python/packagekit/backend.py @@ -64,34 +64,34 @@ class PackageKitBaseBackend: # try to get LANG try: self.lang = os.environ['LANG'] - except KeyError, e: + except KeyError as e: print "Error: No LANG envp" # try to get NETWORK state try: if os.environ['NETWORK'] == 'TRUE': self.has_network = True - except KeyError, e: + except KeyError as e: print "Error: No NETWORK envp" # try to get BACKGROUND state try: if os.environ['BACKGROUND'] == 'TRUE': self.background = True - except KeyError, e: + except KeyError as e: print "Error: No BACKGROUND envp" # try to get INTERACTIVE state try: if os.environ['INTERACTIVE'] == 'TRUE': self.interactive = True - except KeyError, e: + except KeyError as e: print "Error: No INTERACTIVE envp" # try to get CACHE_AGE state try: self.cache_age = int(os.environ['CACHE_AGE']) - except KeyError, e: + except KeyError as e: pass def doLock(self): @@ -749,9 +749,9 @@ class PackageKitBaseBackend: while True: try: line = sys.stdin.readline().strip('\n') - except IOError, e: + except IOError as e: self.error(ERROR_TRANSACTION_CANCELLED, 'could not read from stdin: %s' % str(e)) - except KeyboardInterrupt, e: + except KeyboardInterrupt as e: self.error(ERROR_PROCESS_KILL, 'process was killed by ctrl-c: %s' % str(e)) if not line or line == 'exit': break |