]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
Fix bug with Python warning messages not redirected when sys.stderr is redirected
authorRenaud Barate <renaud.barate@edf.fr>
Tue, 8 Jul 2014 14:48:00 +0000 (16:48 +0200)
committerRenaud Barate <renaud.barate@edf.fr>
Tue, 8 Jul 2014 14:48:00 +0000 (16:48 +0200)
src/KERNEL_PY/kernel/deprecation.py

index 588b4162566975eba2fa75123a91ddf0b39d2787..ebd1b30021691ae346d97bb2b9753e0b7399c435 100644 (file)
@@ -149,7 +149,9 @@ def is_called_by_sphinx():
 
 
 def __show_colored_warning(message, category, filename,
-                           lineno, file = sys.stderr, line = None):
+                           lineno, file = None, line = None):
+    if file is None:
+        file = sys.stderr
     str = warnings.formatwarning(message, category, filename, lineno, line)
     if category == DeprecationWarning and termcolor.canDisplayColor(file):
         file.write(termcolor.makeColoredMessage(str, termcolor.BLUE))