scrapinghub / spidermon

Scrapy Extension for monitoring spiders execution.
https://spidermon.readthedocs.io
BSD 3-Clause "New" or "Revised" License
524 stars 94 forks source link

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

Closed adnan-awan closed 2 months ago

adnan-awan commented 3 months ago

====================================================================== 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 3 months ago

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

rromaniuc commented 2 months ago

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