[issue13582] IDLE and pythonw.exe stderr problem
Todd Rovito
report at bugs.python.org
Sun Jul 7 06:26:50 CEST 2013
Todd Rovito added the comment:
Terry,
Bottom line I can't seem to get this patch to do anything for me. Before the patch is applied IDLE seems to be handling warnings and exceptions just fine in PyShell on the Mac. I get no crash and the output matches the normal console. Here is a small test program I wrote:
import warnings
def fxn():
# user warnings are not ignored by default and will cause a dump of information
# to standard error.
warnings.warn("User warning: Warn on purpose for IDLE", UserWarning)
if __name__ == "__main__":
fxn()
print("the program should not terminate with the warning, but keep on running")
a = 10 * 1000
print(a)
# exception testing each of these will stop the program
# divide by zero
b = 10 * (1/0)
print(b)
# variable not defined
c = 4 + spam*3
print(c)
# can't convert 'int' object o str implicitly
d = '2' + 2
print(d)
Then I wanted to make sure I was executing the patched code so I made sure I called idle.pyw (normally I wouldn't do that I would use idle.py). After I called the correct script I changed the code to force std error to ErrorNotify class around line 101:
import sys
##if 0: # For testing
## sys.__stderr__ = None
## sys.stderr = None
if sys.__stderr__ is None:
sys.__stderr__ = ErrorNotify()
if sys.stderr is None:
sys.stderr = ErrorNotify()
if sys.__stdout__ is None:
sys.__stdout__ = ErrorNotify(devnull=True)
if sys.stdout is None:
sys.stdout = ErrorNotify(devnull=True)
sys.__stderr__ = ErrorNotify()
sys.stderr = ErrorNotify()
I would expect after this code runs any message sent to stderr would go through the ErrorNotify class and a widget should appear with the stderr output. Even after this change I can't get the error widget to appear. I have not given up yet but I wanted to provide a status update.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13582>
_______________________________________
More information about the Python-bugs-list
mailing list