L
L
leham12020-05-21 14:20:20
Python
leham1, 2020-05-21 14:20:20

How can I find out which line the error occurred on?

I want to pledge each term (just to look at the log, immediately see in which line the error occurred. Just for this). But I don’t want to write a logger in each line at all, since the readability of the code will be very bad.
Does anyone know how you can immediately find out in which line an error occurred?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir, 2020-05-21
@leham1

import logging
try:
    1/0
except ZeroDivisionError as e:
    logging.exception("message")

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question