Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#13188 closed Bug Report - Crash (fixed)

Datetime calculation error

Reported by: morten@… Owned by: Mark Spieth
Priority: minor Milestone: 29.1
Component: Bindings - Python Version: v29.0
Severity: medium Keywords:
Cc: Ticket locked: no

Description

In requests_cache_compatability.py line 40 it fails:

self.cache.remove_old_entries(datetime.utcnow() - self._cache_expire_after)

as it aught to be:

self.cache.remove_old_entries(datetime.utcnow() - timedelta(self._cache_expire_after))

Attachments (1)

expire_after.patch (813 bytes) - added by Mark Spieth 2 years ago.

Download all attachments as: .zip

Change History (8)

comment:1 Changed 2 years ago by morten@…

Original error message:

requests_cache_compatability.py:40:remove_expired_responses:TypeError: unsupported operand type(s) for -: 'datetime.datetime' and 'int'

Pull request to solve problem: https://github.com/MythTV/mythtv/pull/162

comment:2 Changed 2 years ago by Stuart Auchterlonie

Milestone: unknown29.1

lgtm; :shipit:

comment:3 Changed 2 years ago by Peter Bennett

Owner: changed from Raymond Wagner to Mark Spieth
Status: newassigned

Assigning to Mark as he did the update to ttvdb code.

comment:4 Changed 2 years ago by Mark Spieth

The appended solution is not sufficient for all versions of requests_cache. It needs to check if its not a timedelta and then convert it if necessary to a timedelta with seconds= as the param. I have a patch ready but just need to test before I commit.

Changed 2 years ago by Mark Spieth

Attachment: expire_after.patch added

comment:5 Changed 2 years ago by Mark Spieth <mspieth@…>

Resolution: fixed
Status: assignedclosed

In 68e982ee82f079c92d7ccd007859fff36541a4ed/mythtv:

Convert monkey patch _cache_expire_after to timedelta if its not already

Fixes #13188

comment:6 Changed 2 years ago by Mark Spieth <mspieth@…>

In 152529781bdc01f26974f4dc24ddae9202740849/mythtv:

Convert monkey patch _cache_expire_after to timedelta if its not already

Refs #13188
(cherry picked from commit 68e982ee82f079c92d7ccd007859fff36541a4ed)

comment:7 Changed 2 years ago by Mark Spieth <mspieth@…>

In 5d9b8f1979c84325110cfca881cee9b15f5cabc0/mythtv:

Convert monkey patch _cache_expire_after to timedelta if its not already

Refs #13188
(cherry picked from commit 68e982ee82f079c92d7ccd007859fff36541a4ed)

Note: See TracTickets for help on using tickets.