I am printing Python exception messages to a log file with logging.error:
except ZeroDivisionError as e:
logging.error(e) # ERROR:root:division by zero
Is it possible to print more detailed information about the exception and the code that generated it than just the exception string?
Using exc_info options may be better, to allow you to choose the error level (if you use exception, it will always be at the error level):
# do something here
except Exception as e:
Hope this works!!
Good question. I actually was stuck with ...READ MORE
Web scraping is a technique to automatically ...READ MORE
Rollback pip to an older ...READ MORE
yes, you can use "os.rename" for that. ...READ MORE
suppose you have a string with a ...READ MORE
You can also use the random library's ...READ MORE
colors = ['red', 'green', ...READ MORE
can you give an example using a ...READ MORE
In most applications, you won't be calling ...READ MORE
You need to call os.path.realpath on __file__, so that when __file__ is ...READ MORE
Already have an account? Sign in.