diff --git a/cyruslib.py b/cyruslib.py
--- a/cyruslib.py
+++ b/cyruslib.py
@@ -37,7 +37,7 @@
     import imaplib
     import re
     from binascii import b2a_base64
-except ImportError, e:
+except ImportError as e:
     print(e)
     exit(1)
 
diff --git a/ext/python/Tools/freeze/freeze.py b/ext/python/Tools/freeze/freeze.py
--- a/ext/python/Tools/freeze/freeze.py
+++ b/ext/python/Tools/freeze/freeze.py
@@ -317,7 +317,7 @@
         try:
             os.mkdir(odir)
             print("Created output directory", odir)
-        except os.error, msg:
+        except os.error as msg:
             usage('%s: mkdir failed (%s)' % (odir, str(msg)))
     base = ''
     if odir: