1#!/usr/bin/env python
2"""
3This script shows how to use PyObjCTools.Debugging to show a dump of all
4(Cocoa) exceptions (handled and unhandled).
5"""
6from PyObjCTools import AppHelper
7from PyObjCTools import Debugging
8from Foundation import *
9
10class FooTester(NSObject):
11    def doBadThingsNow_(self, aTimer):
12        AppHelper.stopEventLoop()
13        raise ValueError, "doing bad things"
14
15foo = FooTester.alloc().init()
16NSTimer.scheduledTimerWithTimeInterval_target_selector_userInfo_repeats_(
17    0.0, foo, 'doBadThingsNow:', None, False
18)
19# we need to catch everything, because NSTimer handles this one
20Debugging.installVerboseExceptionHandler()
21AppHelper.runConsoleEventLoop()
22