Mailing List Archive

ttvdb on Fedora 26
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.


File "./ttvdb.py", line 544, in __main__
Failed example:
main()
Exception raised:
Traceback (most recent call last):
File "/usr/lib64/python2.7/doctest.py", line 1315, in __run
compileflags, 1) in test.globs
File "<doctest __main__[25]>", line 1, in <module>
main()
File "./ttvdb.py", line 2062, in main
userkey=tvdb_account.account_identifier)
File "/home/david/Projects/MythTv/mythtv-
master/mythtv/bindings/python/MythTV/ttvdb/tvdb_api.py", line 693, in
__init__
self.session.remove_expired_responses()
File "/home/david/Projects/MythTv/mythtv-
master/mythtv/bindings/python/MythTV/ttvdb/requests_cache_compatability
.py", line 40, in remove_expired_responses
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


_______________________________________________
mythtv-dev mailing list
mythtv-dev@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-dev
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: ttvdb on Fedora 26 [ In reply to ]
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.

--
Bill
_______________________________________________
mythtv-dev mailing list
mythtv-dev@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-dev
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: ttvdb on Fedora 26 [ In reply to ]
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


_______________________________________________
mythtv-dev mailing list
mythtv-dev@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-dev
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: ttvdb on Fedora 26 [ In reply to ]
On 08/30/2017 07:45 AM, David Hampton wrote:
> Anyone know where to ask the fedora maintainers to update a package?
>
> David

You can try installing python-pip and then running this :
pip install --upgrade future requests requests_cache

Peter
_______________________________________________
mythtv-dev mailing list
mythtv-dev@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-dev
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: ttvdb on Fedora 26 [ In reply to ]
On Wed, Aug 30, 2017 at 9:31 AM, Peter Bennett <pgbennett@comcast.net>
wrote:

>
> On 08/30/2017 07:45 AM, David Hampton wrote:
>
>> Anyone know where to ask the fedora maintainers to update a package?
>
>
You can always email <package>-owner@fedoraproject.org and any maintainer
associated with the package will get the email. Alternatively, you can file
a bug at bugzilla.redhat.com against the package (be sure to put it in the
Fedora section, no RHEL or EPEL)

Thanks,
Richard
Re: ttvdb on Fedora 26 [ In reply to ]
On Wed, 2017-08-30 at 10:31 -0400, Peter Bennett wrote:
>
> On 08/30/2017 07:45 AM, David Hampton wrote:
> > Anyone know where to ask the fedora maintainers to update a
> > package?
> >
> > David
>
> You can try installing python-pip and then running this :
> pip install --upgrade future requests requests_cache

Thanks Peter. That's a command that a developer would use, and I
probably will do that myself. I'd like users to be able to update
these packages the usual way, via a "yum/dnf update" command. It would
also make it easier to package mythtv for fedora based platforms.

David

_______________________________________________
mythtv-dev mailing list
mythtv-dev@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-dev
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org