python - Print error to screen but continue code execution -


i have code iterates through series of urls. if there error in code because 1 of urls not contain valid json body, want error generated printed screen, code moves onto next iteration. simple version of code is:

for in myurls:      try:          #mycode      except exception exc:          print traceback.format_exc()         print exc         pass 

however prints error screen , ends execution of code. there way can error continue execution moving next iteration of 'for' loop?

just put try-except on code expect exception occur. code lies inside loop.

for in myurls:     try:         #mycode      except exception exc:          print traceback.format_exc()         print exc 

Comments

Popular posts from this blog

javascript - Google App Script ContentService downloadAsFile not working -

javascript - Function overwritting -

c# - Exception when attempting to modify Dictionary -