Karim wrote:
> I want to fire my own exception without having the (useful but ugly in
> my case) stack trace display.
Printing the stack trace is part of the standard exception handling. For an
uncaught exception python will call sys.excepthook which in turn will print
the traceback unless you have set it to a custom function.
> How to modify a Exception type class for that purpose which looks like:
>
> classs MyError(Exception):
> pass
You don't modify the exception, you handle it explicitly. Wrap your code
into try ... except:
# before
main() # may raise MyError
# after
try:
main()
except MyError as e:
print(e)
_______________________________________________
Tutor maillist - [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor