Home > Back-end >  MyPy complains about datetime difference
MyPy complains about datetime difference

Time:05-29

MyPy complains about the line of code where bar is assigned the difference of two datetimes.

The type of foo is datetime.timedelta.

The error message from MyPy is "int not callable".

What am I missing?

import arrow

t1 = arrow.now()
t2 = arrow.now()
foo = t1 - t2
bar = foo.total_seconds()

CodePudding user response:

This turned out to be a known issue. For details, see the following:

https://github.com/python/mypy/issues/11613

  • Related