you should try putting it all in one try except loop as it just ends anytime. Otherwisw 1300 lines is crazy