Global "except" condition

Steve Holden steve at holdenweb.com
Tue Jul 11 07:05:23 EDT 2006


Ernesto wrote:
> Within the scope of one Python file (say myFile.py), I'd like to print
> a message on ANY exception that occurs in THAT file, dependent on a
> condition.
> 
> Here's the pseudocode:
> 
> if anyExceptionOccurs():
>       if myCondition:
>             print "Here's my global exception message"
> 
> 
> Is this functionality possible in python?  If so, how?
> 
What if your module defines a function, and then that function is called 
from some other module and raises an exception. Would you then want the 
global exception message to appear?

If so then I'm not sure that what you want is possible.

regards
  Steve
-- 
Steve Holden       +44 150 684 7255  +1 800 494 3119
Holden Web LLC/Ltd          http://www.holdenweb.com
Skype: holdenweb       http://holdenweb.blogspot.com
Recent Ramblings     http://del.icio.us/steve.holden




More information about the Python-list mailing list