Added some print statements. Suspect line 267 to be the cause of the error, though I don't think it should even be going to that function.