Issue #16706: get rid of os.error
diff --git a/Lib/lib2to3/main.py b/Lib/lib2to3/main.py
index f9cc18b..93bae90 100644
--- a/Lib/lib2to3/main.py
+++ b/Lib/lib2to3/main.py
@@ -90,11 +90,11 @@
             if os.path.lexists(backup):
                 try:
                     os.remove(backup)
-                except os.error as err:
+                except OSError as err:
                     self.log_message("Can't remove backup %s", backup)
             try:
                 os.rename(filename, backup)
-            except os.error as err:
+            except OSError as err:
                 self.log_message("Can't rename %s to %s", filename, backup)
         # Actually write the new file
         write = super(StdoutRefactoringTool, self).write_file
diff --git a/Lib/lib2to3/refactor.py b/Lib/lib2to3/refactor.py
index 201e193..87f686e 100644
--- a/Lib/lib2to3/refactor.py
+++ b/Lib/lib2to3/refactor.py
@@ -534,12 +534,12 @@
         """
         try:
             f = _open_with_encoding(filename, "w", encoding=encoding)
-        except os.error as err:
+        except OSError as err:
             self.log_error("Can't create %s: %s", filename, err)
             return
         try:
             f.write(_to_system_newlines(new_text))
-        except os.error as err:
+        except OSError as err:
             self.log_error("Can't write %s: %s", filename, err)
         finally:
             f.close()
diff --git a/Lib/lib2to3/tests/pytree_idempotency.py b/Lib/lib2to3/tests/pytree_idempotency.py
index a02bbfe..731c403 100755
--- a/Lib/lib2to3/tests/pytree_idempotency.py
+++ b/Lib/lib2to3/tests/pytree_idempotency.py
@@ -53,7 +53,7 @@
     for dir in sys.path:
         try:
             names = os.listdir(dir)
-        except os.error:
+        except OSError:
             continue
         print("Scanning", dir, "...", file=sys.stderr)
         for name in names: