On Sun, Feb 1, 2009 at 6:31 PM, LX <lxk...@gmail.com> wrote: > This one has me mystified good! > > This works (print statement is executed as the Exception is caught) as > advertised: > try: > raise AssertionError > except AssertionError: > print "caught AssertionError" > > > But this one does not: > > def test(): > raise AssertionError > > try: > test() > except AssertionError: > print "caught AssertionError" > > other errors (e.g. IOError) work fine! This is on OSX 10.5.6, with the > standard Python 2.5 (r25:51918, Sep 19 2006, 08:49:13) > [GCC 4.0.1 (Apple Computer, Inc. build 5341)]. > > Is this a bug? Any hints / help would be much appreciated! Thank you.
My Mac begs to differ: ~ $ cat Desktop/tmp.py def test(): raise AssertionError try: test() except AssertionError: print "caught AssertionError" ~ $ /System/Library/Frameworks/Python.framework/Versions/2.5/bin/python2.5 Desktop/tmp.py caught AssertionError ~ $ /System/Library/Frameworks/Python.framework/Versions/2.5/bin/python2.5 Python 2.5.1 (r251:54863, Feb 4 2008, 21:48:13) [GCC 4.0.1 (Apple Inc. build 5465)] on darwin The problem must lie elsewhere. Cheers, Chris -- Follow the path of the Iguana... http://rebertia.com -- http://mail.python.org/mailman/listinfo/python-list