[mythtv-users] MythTV and Python 3

Stephen Worthington stephen_agent at jsw.gen.nz
Tue Oct 14 08:09:51 UTC 2014


On Tue, 14 Oct 2014 09:56:46 +0200, you wrote:

>2014-10-14 9:47 GMT+02:00 Stephen Worthington <stephen_agent at jsw.gen.nz>:
>
>> On Tue, 14 Oct 2014 09:06:35 +0200, you wrote:
>>
>> >2014-10-14 3:26 GMT+02:00 Stephen Worthington <stephen_agent at jsw.gen.nz>:
>> >
>> >> 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.  So I grabbed one of the MythTV scripts I downloaded a
>> >> while ago (tunerstatus.py) and converted it to Python 3 to see if it
>> >> would work.  But this is what I got:
>> >>
>> >> root at mypvr:~# tunerstat.py
>> >> Traceback (most recent call last):
>> >>   File "/usr/local/bin/tunerstat.py", line 6, in <module>
>> >>     from MythTV import MythDB, MythBE
>> >> ImportError: No module named 'MythTV'
>> >>
>> >> So it looks like the MythTV package(s) are not installed for Python 3.
>> >> I have only dabbled in Python so far - I am far from an expert.  So I
>> >> was wondering if anyone had run across this and if there was an easy
>> >> solution, or whether I have to keep using Python 2 for now.
>> >>
>> >> And in general, what is the state of play with MythTV and Python 3?
>> >> Are the MythTV bindings Python 3 compatible?  Is anyone working on
>> >> moving MythTV scripts to Python 3?
>>
>> >It doesn't matter if it is compiled with python 2 or 3, that error just
>> >means that Python can't find the Mythtv module. Check so that you have
>> >access to the mythtv modules in your site packages for python.
>> >
>> >Regards,
>> >
>> >Andréas
>>
>> Yes, I figured that was what the error meant.  But the Python 2 MythTV
>> packages are installed automatically as part of MythTV on Mythbuntu,
>> so I have no idea as yet how to install them for Python 3 or if they
>> would work if I did.  Synaptic says they are in the libmyth-python deb
>> package and install to /usr/lib/python2.7/dist-packages/MythTV/ in
>> Mythbuntu 14.04.
>
>You should have a dist-packages for the python 3 library as well. Probably
>under /usr/lib/python3/dist-packages.
>
>If you copy the .py files to that directory, you should get access to the
>mythtv packages. However, they probably are not installed in python 3 for
>good reason. The difference between python 2 and 3 is not that big, but I
>have had to rewrite several packages just to get some packages to work. You
>probably will have to go through the packages and change some syntax and so
>on. However if you do, you could offer to upload your solution to the
>maintainer of the python packages in mythtv, so that we get python 3
>support (you could also rewrite them so that python 2 or 3 can be used).
>
>I think that changing to python 3 will not happen in the near future
>however. Python 3 has been around for more than 10 years and the support
>for it is unfortunately rather bad still. As you have mentioned Python 3
>support is being favoured by the ubuntu distributions, but we will still
>need support for Python 2 for a long time.
>
>Regards,
>
>Andréas

No, I think you are wrong about that.  Python 2 is now deprecated by
Python - there are no more updates going to be done for Python 2
(although there will be bug fixes).  So Python 2.7 is the last version
of Python 2.  All support is now for Python 3 only going forwards.

  http://legacy.python.org/dev/peps/pep-0373/

So Ubuntu is just preparing for that change, not leading the way.


More information about the mythtv-users mailing list