Reputation: 141
TypeError: unsupported operand type(s) for -: 'int' and 'NoneType'
Could somebody tell me what this error means please.
Upvotes: 0
Views: 93
Reputation: 122091
It means that you have done e.g.
a = b - c
but, although b
is an int
, c is None
and therefore the subtraction operation cannot happen.
As to the root cause, it is most likely that at some point c = some_function()
and there is a path through some_function
that will (implicitly or explicitly) return None
.
Upvotes: 5
Reputation: 8400
TypeError: unsupported operand type(s) for -: 'int' and 'NoneType'
From the error mentioned above it is clear that you are performing some kind of operation on data which is having data-type different. One is int and other is None.
This means you can not perform specific operation on the two operands having different data-types.
It is similar to : adding two mangoes into 3 banana and the result is unknown.
Upvotes: 0