I'm writing a program that parses a 10 websites, locates data files, saves the files, and then parses them to make data that can be readily used in numpy. There are TONS of errors this file encounters through bad links, poorly formed xml, missing entries, and other things I've yet to categorize. I initially made this program to handle errors like this:
try:
do_stuff()
except:
pass
But now I want to log errors.
try:
do_stuff()
except Exception, err:
print Exception, err
Note this is printing to a log file for later review. This usually prints very useless data. What I want is to print the exact same lines printed when the error triggers without the try-except intercepting the exception, but I don't want it to halt my program since it is nested in a series of for loops that I would like to see to completion. Do your thing, stackoverflow!