This is 4 __if__'s deep, and there are other similar places below.  Consider taking these "sections" of code, and sticking them into simple functions.  Even if the function is only called once, it will make the code more readable.  It also makes it easier to wrap things up inside try...except... structures.