I am downloading a file from the net, and it fails even though I am doing:
for p in query:
try:
except IOError as e:
print e;
If th
This will write your error to a log file and continue to run the code.
import traceback
#This line opens a log file
with open("log.txt", "w") as log:
try:
# some code
# Below line will print any print to log file as well.
print("Creating DB Connection", file = log)
except Exception:
traceback.print_exc(file=log)
continue