I'm creating a program that receives files from the website and reads the data as numpy. But when I receive the file, there are countless errors due to strange links or wrong xml structures ㅜ<
I'd like to make an exception by saving the error message log that comes out when there is no exception in the text file and reviewing it all at once later If you write the code below together, you don't know where the error came from, and other information disappears, so only almost useless data continues to be printed.
try:
do_stuff()
except Exception, err:
print Exception, err
How do I know exactly where the error occurred in which module?
python exception-handling
traceback.format_exc() or sys.exc_info()
Example:
import traceback
import sys
try:
do_stuff() #What code
except Exception, err:
print(traceback.format_exc())
#or
print(sys.exc_info()[0])
572 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
912 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
617 Uncaught (inpromise) Error on Electron: An object could not be cloned
610 GDB gets version error when attempting to debug with the Presense SDK (IDE)
© 2024 OneMinuteCode. All rights reserved.