"Also, having both the try and except on one line does not really make sense; the OP wanted the exception on one line, not the whole snippet." . . . .