[BangPypers] suppressing the exception stack trace
steve at lonetwin.net
Tue Sep 15 17:37:27 CEST 2009
On 09/15/2009 08:56 PM, Vishal wrote:
> I would like to raise an exception of type Exception(), however the
> regular exception stack trace needs to be supressed.
> This is needed in a function that takes raw_input() from the user and
> based on 'Y' or 'N', the function suspends further execution and returns
> to the python prompt or continues. An exit() brings it out of the python
> process....where as what is needed is coming back to the python prompt.
> I want a custom message to appear instead of a regular exception stack
> trace message.
> How to do this? any pointers...?
Python 2.6 (r26:66714, Jun 8 2009, 16:07:29)
[GCC 4.4.0 20090506 (Red Hat 4.4.0-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import traceback
... 1 + "foo"
... except Exception, e:
[' File "<stdin>", line 4, in <module>\n']
random non tech spiel: http://lonetwin.blogspot.com/
tech randomness: http://lonehacks.blogspot.com/
what i'm stumbling into: http://lonetwin.stumbleupon.com/
More information about the BangPypers