also, a bit of unsolicited advice. it looks like this is all wrapped in a try/except block. a common thing for new programmers to do is to wrap all your code in a ton of error handling. I'd recommend stripping this out. if your code is raising an error, it's usually trying to tell you something. read this guide to understanding the
python traceback and write your code so that if there is an error, you'll find out exactly what's going wrong, rather than trying to magically handle it for yourself - that tends to result in really hard to debug problems. —
Michael Delgado 41 secs ago