This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Todd.Rovito
Recipients Todd.Rovito, amaury.forgeotdarc, asvetlov, devplayer, ggenellina, ned.deily, roger.serwy, terry.reedy
Date 2013-07-07.04:26:50
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1373171210.88.0.430508024294.issue13582@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2013-07-07 04:26:50Todd.Rovitosetrecipients: + Todd.Rovito, terry.reedy, amaury.forgeotdarc, ggenellina, ned.deily, roger.serwy, asvetlov, devplayer
2013-07-07 04:26:50Todd.Rovitosetmessageid: <1373171210.88.0.430508024294.issue13582@psf.upfronthosting.co.za>
2013-07-07 04:26:50Todd.Rovitolinkissue13582 messages
2013-07-07 04:26:50Todd.Rovitocreate