[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [fallback-scripts/master] update: py3: Use py3 exception syntax



commit 86247cdedd318ba34f0707f62e5606e5359eafe3
Author: teor <teor@xxxxxxxxxxxxxx>
Date:   Mon Dec 2 15:01:57 2019 +1000

    update: py3: Use py3 exception syntax
    
    Part of 28863.
---
 updateFallbackDirs.py | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/updateFallbackDirs.py b/updateFallbackDirs.py
index 77e9bbb..fe78fbd 100755
--- a/updateFallbackDirs.py
+++ b/updateFallbackDirs.py
@@ -514,7 +514,7 @@ def write_to_file(str, file_name, max_len):
   try:
     with open(file_name, 'w') as f:
       f.write(str[0:max_len])
-  except EnvironmentError, error:
+  except EnvironmentError as error:
     logging.error('Writing file %s failed: %d: %s'%
                   (file_name,
                    error.errno,
@@ -526,7 +526,7 @@ def read_from_file(file_name, max_len):
     if os.path.isfile(file_name):
       with open(file_name, 'r') as f:
         return f.read(max_len)
-  except EnvironmentError, error:
+  except EnvironmentError as error:
     logging.info('Loading file %s failed: %d: %s'%
                  (file_name,
                   error.errno,
@@ -557,7 +557,7 @@ def load_json_from_file(json_file_name):
     try:
       with open(json_file_name, 'r') as f:
         return json.load(f)
-    except EnvironmentError, error:
+    except EnvironmentError as error:
       raise Exception('Reading not-modified json file %s failed: %d: %s'%
                     (json_file_name,
                      error.errno,
@@ -635,7 +635,7 @@ def onionoo_fetch(what, **kwargs):
     try:
       response = urllib2.urlopen(request)
       response_code = response.getcode()
-    except urllib2.HTTPError, error:
+    except urllib2.HTTPError as error:
       response_code = error.code
       if response_code == 304: # not modified
         pass
@@ -1415,7 +1415,7 @@ class Candidate(object):
       end = datetime.datetime.utcnow()
       time_since_expiry = (end - consensus.valid_until).total_seconds()
       time_until_valid = (consensus.valid_after - end).total_seconds()
-    except Exception, stem_error:
+    except Exception as stem_error:
       end = datetime.datetime.utcnow()
       log_excluded('Unable to retrieve a consensus from %s: %s', nickname,
                     stem_error)



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits