Answer the question
In order to leave comments, you need to log in
How to display python script errors in browser window?
I am writing a script for web. When an error occurs, either an error 500 appears or only part of the text is displayed up to the place of the error. You have to run the script in the console to see the error text. How to view debug information in a browser window?
Answer the question
In order to leave comments, you need to log in
import cgitb
cgitb.enable()
The context is not entirely clear. What do you write and, most importantly, what tools do you use.
But in general try this:
import traceback
try:
...ваш код...
except BaseException as error:
full_traceback = traceback.format_exc()
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question