Re: Detecting an active exception

2007-06-03 Thread Nick Craig-Wood
NeBlackCat <[EMAIL PROTECTED]> wrote: > I've now also looked at this from a traceback and stack frame walking > perspective as well and it seems impossible, ie. it see,s impossible to > create a function AmIHandlingAnException() which would behave as follows: > >try: >a=a+1 >e

Re: Detecting an active exception

2007-06-02 Thread Steve Holden
Duncan Booth wrote: > "NeBlackCat (lists)" <[EMAIL PROTECTED]> wrote: > >> Depending on what you read, sys.exc_info() is supposed to return >> (None,None,None) when there is no active exception, but it seems that >> it returns info about the last exception when there isn't one >> currently active

Re: Detecting an active exception

2007-06-01 Thread NeBlackCat
I've now also looked at this from a traceback and stack frame walking perspective as well and it seems impossible, ie. it see,s impossible to create a function AmIHandlingAnException() which would behave as follows: try: a=a+1 except: pass try: AmIHandlingAnException()

Re: Detecting an active exception

2007-06-01 Thread NeBlackCat
Thanks Duncan - that does clear things up for me on how sys.exc_info() it actually works! But it does seem that there is no way to test "am I currently running in the scope of handling of an exception", which is what I need. If there was, I could then rely on sys.exc_info() to examine the excep

Re: Detecting an active exception

2007-06-01 Thread Duncan Booth
"NeBlackCat (lists)" <[EMAIL PROTECTED]> wrote: > Depending on what you read, sys.exc_info() is supposed to return > (None,None,None) when there is no active exception, but it seems that > it returns info about the last exception when there isn't one > currently active. > > For example: > > try

Detecting an active exception

2007-06-01 Thread NeBlackCat (lists)
Hello everybody - my first post! And it may be the most monumentally stupid question ever asked, but I just can't see an answer after several hours experimenting, searching and reading. It's simply this - how can a function determine whether or not it's being called in handling of an exception