Am 20.11.21 um 20:15 schrieb Ulli Horlacher:
Stefan Ram wrote:
r...@zedat.fu-berlin.de (Stefan Ram) writes:
except Exception as inst:
print( traceback.format_exc() )
More to the point of getting the line number:
As I wrote in my initial posting:
I already have the line number. I am
Stefan Ram wrote:
> r...@zedat.fu-berlin.de (Stefan Ram) writes:
> >except Exception as inst:
> >print( traceback.format_exc() )
>
> More to the point of getting the line number:
As I wrote in my initial posting:
I already have the line number. I am looking for the source code line!
So
Have you tried the logger module and the format options?
On Fri, 19 Nov 2021 at 19:09, Ulli Horlacher
wrote:
>
> I am trying to get the source code line of the last error.
> I know traceback.format_exc() but this contains much more information, e.g.:
>
> Traceback (most recent call last):
>
I am trying to get the source code line of the last error.
I know traceback.format_exc() but this contains much more information, e.g.:
Traceback (most recent call last):
File "./error.py", line 18, in main
x=1/0
ZeroDivisionError: division by zero
I could extract the source code line with