[mythtv-users] MythTV and Python 3

Andréas Kühne andreas at kuhne.se
Tue Oct 14 07:56:46 UTC 2014


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.
> _______________________________________________
> mythtv-users mailing list
> mythtv-users at mythtv.org
> http://www.mythtv.org/mailman/listinfo/mythtv-users
> http://wiki.mythtv.org/Mailing_List_etiquette
> MythTV Forums: https://forum.mythtv.org
>

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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.mythtv.org/pipermail/mythtv-users/attachments/20141014/80445371/attachment.html>


More information about the mythtv-users mailing list