bpo-30022: Get rid of using EnvironmentError and IOError (except test… (#1051)

diff --git a/Lib/idlelib/run.py b/Lib/idlelib/run.py
index afa9744..12c339f 100644
--- a/Lib/idlelib/run.py
+++ b/Lib/idlelib/run.py
@@ -52,7 +52,7 @@
     try:
         file.write(idle_formatwarning(
                 message, category, filename, lineno, line))
-    except IOError:
+    except OSError:
         pass # the file (probably stderr) is invalid - this warning gets lost.
 
 _warnings_showwarning = None