Message293837
I'm trying to completely hide an exception from the traceback module. From reading the source, it looks like the only way to do this is to set __traceback__ to None (I can also set __suppress_context__ to True, but that only works if I have another exception higher up in the context chain).
However, this still prints the traceback itself, and the line for SyntaxErrors. Consider the attached test.py. It outputs
ValueError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "test.py", line 8, in <module>
raise TypeError
TypeError
File "<string>", line 1
a b
^
SyntaxError: unexpected EOF while parsing
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "test.py", line 19, in <module>
raise TypeError
TypeError
I suppose it should also not print the "During handling of the above exception, another exception occurred:" part. |
|
Date |
User |
Action |
Args |
2017-05-17 04:03:35 | Aaron.Meurer | set | recipients:
+ Aaron.Meurer |
2017-05-17 04:03:35 | Aaron.Meurer | set | messageid: <1494993815.34.0.567809017687.issue30384@psf.upfronthosting.co.za> |
2017-05-17 04:03:35 | Aaron.Meurer | link | issue30384 messages |
2017-05-17 04:03:34 | Aaron.Meurer | create | |
|