scrapinghub/spidermon

TypeError: can't subtract offset-naive and offset-aware datetimes

adnan-awan opened this issue · 2 comments

======================================================================
ERROR: Periodic execution time monitor/Maximum execution time reached

Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/spidermon/contrib/scrapy/monitors/monitors.py", line 497, in test_execution_time
duration = now - start_time
~~~~^~~~~~~~~~~~
TypeError: can't subtract offset-naive and offset-aware datetimes

I investigated it and found that the datetime.utcnow() function in Python returns a naive datetime object because it does not include timezone information. Naive datetime objects do not have an associated timezone.

wRAR commented

I thought it's already fixed, or was that in a different monitor?

hi @adnan-awan @wRAR, any idea on when this issue might be fixed? I'm having same issue on different jobs