[mythtv-users] MythTV and Python 3

Raymond Wagner raymond at wagnerrp.com
Wed Oct 15 01:54:05 UTC 2014


On 10/14/2014 3:19 PM, Hika van den Hoven wrote:
> Hoi Gary,
>
> Tuesday, October 14, 2014, 11:07:13 PM, you wrote:
>
>> On Tue, Oct 14, 2014 at 1:26 AM, Stephen Worthington
>> <stephen_agent at jsw.gen.nz> wrote:
>>> Mythbuntu 14.04, MythTV 0.27+fixes
>>>
>>> I was just looking at using Python for another MythTV script and I
>>> realised I should be writing it in Python 3 now that Python 2 is
>>> deprecated.
>> There has been no official deprecation.  Python 2.7
>> is just "legacy".
>> There is certainly some in the python community
>> that like using the tactic of saying deprecation since
>> they no longer want to work on things called legacy
>> (support and fixing things is no fun; writing new code
>> is fun).
>> Certainly if someone is writing (entirely) new
>> development of (entirely) new applications with
>> (entirely) new support modules, one should look
>> towards python 3 (I know I do).  But python 2.7
>> will be supported for a very long time.  I expect
>> much longer than the official EOL 2020 date
>> because enterprise linux distributions have
>> committed support dates far longer than that
>> (and rumor has it that some major corporations
>> have substantial internal commitments to 2.7
>> that is not going away any time soon).
>> And in any event, 98% of the interesting stuff is
>> not the language itself (2 vs 3), but the surrounding
>> eco-system libraries/modules, and that continues
>> to thrive in both versions.
>> Python 2 is dead, long live python 2.
>>> Are the MythTV bindings Python 3 compatible?
>> They are currently written for Python 2.  Python 3
>> is not 100% language compatible (although for
>> some simple cases, one can do various translations
>> and/or compatibility functions (see six)).
>>> Is anyone working on
>>> moving MythTV scripts to Python 3?
>> I believe it is on the (very large) to-do list.  Given
>> that python 2.7 has a long life ahead of it I
>> personally see no particular rush to expect a
>> dev to rearrange their priorities.
>> <conjecture>
>> And with 0.28 having an even more complete
>> services API, there is an opportunity to rework
>> the entire bindings structure (no more direct
>> internal DB access, for example, since that,
>> too, is "legacy" and targeted to be dropped at
>> some unspecified future point in time).  But
>> that is even more work than some simple
>> 2 to 3 translation.
>> </conjecture>
>> If I was writing a python 3 function today
>> to interface with MythTV, I would likely look
>> to using the services API.  Python has lots
>> of good modules for accessing such services.
>> _______________________________________________
> One thing though, set the header right!
> Not #!/usr/bin/env python but #!/usr/bin/env python2 or
> #!/usr/bin/env python3 if it is 3
>
> While I don't know python, I have had to set it right more than once
> to work.

The configure script allows one to specify a python executable that gets 
automatically added to the "bang" at the top of the scripts during 
installation.


More information about the mythtv-users mailing list