python catch exception list index out of range