Replace IOError with OSError (#16715)
diff --git a/Lib/netrc.py b/Lib/netrc.py
index c96db6f..7fe69ee 100644
--- a/Lib/netrc.py
+++ b/Lib/netrc.py
@@ -25,7 +25,7 @@
             try:
                 file = os.path.join(os.environ['HOME'], ".netrc")
             except KeyError:
-                raise IOError("Could not find .netrc: $HOME is not set")
+                raise OSError("Could not find .netrc: $HOME is not set")
         self.hosts = {}
         self.macros = {}
         with open(file) as fp: