Try/except sounds like the way to go. Thanks.
--
http://mail.python.org/mailman/listinfo/python-list
Lunchtimemama wrote:
> What is the superior method of exception handling:
...
For a start, note that the exception hook does not _really_ have to be
in the main module, just imported before any "protected" code is to be
executed.
Having said that, what I personally typically do for exception trap
Thank you for a fine explanation Pat, that clears things up very
nicely. I have one remaining question which I imagine amounts to taste.
What is the superior method of exception handling:
A) To, as you suggest above, import the code as a module from within a
program with special exception handling
Lunchtimemama wrote:
> Forgive my ignorance, but I'm not quite sure what you mean. I tried
> importing the traceback module at the beginning of the script, but that
> didn't make a difference. Could you provide example code to illustrate
> your comment? Thanks.
Assume your main module has your ex
Forgive my ignorance, but I'm not quite sure what you mean. I tried
importing the traceback module at the beginning of the script, but that
didn't make a difference. Could you provide example code to illustrate
your comment? Thanks.
-LTM
--
http://mail.python.org/mailman/listinfo/python-list
Lunchtimemama wrote:
> Yo all, I'm getting into Python for the first time and I'm really
> having a blast. I've hit a bit of a snag and was wondering if someone
> could lend some insight. Here be the code:
>
> import sys
> def myexcepthook(type, value, tb):
> import traceback
> rawreport = tra
Yo all, I'm getting into Python for the first time and I'm really
having a blast. I've hit a bit of a snag and was wondering if someone
could lend some insight. Here be the code:
import sys
def myexcepthook(type, value, tb):
import traceback
rawreport = traceback.format_exception(type, value,