except TypeError, ValueError:
it should be
except (TypeError, ValueError):
When you use except TypeError, ValueError:, you assign an instance of Exception to the variable name ValueError.
, Python do, , ValueError , except TypeError, ValueError: ValueError. try-suite, raise ValueError('yofoo'), ValueError . , UnboundLocalError.
:
... except (RuntimeError, TypeError, NameError):
... pass
, , ValueError, e: , , ValueError e: Python ( ). - . RuntimeError, TypeError (RuntimeError, TypeError): RuntimeError TypeError: , .