[mythtv] ttvdb on Fedora 26

David Hampton mythtv at dhampton.net
Wed Aug 30 11:45:56 UTC 2017


On Tue, 2017-08-29 at 22:46 -0500, Bill Meek wrote:
> On 08/29/2017 08:32 PM, David Hampton wrote:
> > I'm having trouble with the new ttvdb script from master on my
> > Fedora
> > 26 development box.  When I run "./ttvdb.py --doctest" in the
> > source
> > directory, half of the tests fail with the error message
> > "TypeError:
> > unsupported operand type(s) for -: 'datetime.datetime' and 'int'".
> > I've attached a sample traceback.
> 
> ...
> 
>  >      self.cache.remove_old_entries(datetime.utcnow()
> -self._cache_expire_after
> >      TypeError: unsupported operand type(s) for -:
> > 'datetime.datetime' and 'int'
> > 
> > 
> > The python packages available on Fedora are close to what was
> > mentioned
> > elsewhere on the mailing list, but not a strict superset.  I have
> > the
> > following on Fedora 26.
> > 
> >    python2-future-0.16.0-4.fc26.noarch
> >    python2-requests-2.13.0-1.fc26.noarch
> >    python-requests-cache-0.4.6-8.fc26.noarch
> > 
> > Fedora 24 and 25 have the same future and requests-cache versions,
> > but
> > requests is only at 2.10.0 on those releases.
> > 
> > I'm hoping this is a simple fix, like a missing conversion to/from
> > int/datetime.  Please let me know if I can help by testing
> > anything.
> > 
> > David
> 
> On my 14.04 *buntu box, requests-cache is 0.4.13. But I used: pip
> install
> --upgrade requests-cache to get it. My newer boxen have 0.4.13
> available
> as packages (apt-get.)
> 
> In:
> 
>      /usr/lib/python2.7/dist-packages/requests_cache/core.py
> 
> or wherever your packages live, you should see:
> self._cache_expire_after = expire_after.
> And expire_after is an instance of timedelta, not an int.

I have that line in my copy of .../requests_cache/core.py, but the
comment earlier in the init function states that its of type float?

  :param expire_after: number of seconds after cache will be expired
                       or `None` (default) to ignore expiration
  :type expire_after: float

I was able to work around that with a try/except in the
requests_cache_compatability.py file, and immediately ran into another
error:


      ...
      File "/home/david/Projects/MythTv/mythtv-
master/mythtv/bindings/python/MythTV/ttvdb/tvdb_api.py", line 848, in
authorize
        r = self.session.post('https://api.thetvdb.com/login',
json=self.config['auth_payload'], headers=self.headers)
      File "/usr/lib/python2.7/site-packages/requests/sessions.py",
line 535, in post
        return self.request('POST', url, data=data, json=json,
**kwargs)
    TypeError: request() got an unexpected keyword argument 'json'


This appears to be a result of 'requests' adding a new json parameter
in version 2.4.1, and 'requests_cache' not supporting it until version
0.4.7.  Sigh.

Anyone know where to ask the fedora maintainers to update a package?

David




More information about the mythtv-dev mailing list