On 09/15/2009 08:56 PM, Vishal wrote:
Hello,

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
>>> try:
...     1 + "foo"
... except Exception, e:
...     traceback.format_stack(limit=1)
...
['  File "<stdin>", line 4, in <module>\n']
>>> help(traceback)
....

HTH,
- steve

--
random non tech spiel: http://lonetwin.blogspot.com/
tech randomness: http://lonehacks.blogspot.com/
what i'm stumbling into: http://lonetwin.stumbleupon.com/
_______________________________________________
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers

Reply via email to