summaryrefslogtreecommitdiffstats
path: root/Lib/warnings.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/warnings.py')
-rw-r--r--Lib/warnings.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/Lib/warnings.py b/Lib/warnings.py
index 5d5c9a9..3a8fc5d 100644
--- a/Lib/warnings.py
+++ b/Lib/warnings.py
@@ -11,6 +11,9 @@ def showwarning(message, category, filename, lineno, file=None, line=None):
"""Hook to write a warning to a file; replace if you like."""
if file is None:
file = sys.stderr
+ if file is None:
+ # sys.stderr is None when ran with pythonw.exe - warnings get lost
+ return
try:
file.write(formatwarning(message, category, filename, lineno, line))
except OSError: