[mythtv-users] MythTV and Python 3

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


On Tue, 14 Oct 2014 21:05:27 +1300, you wrote:

>On 14/10/14 20:47, Stephen Worthington wrote:
>> 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.
>>
>Hi Stephen,
>
>Slight case of synchronicity. I was just trying a python 2 module (not 
>mythtv) under python 3 and I simply copied the relevant files from 
>/usr/local/lib/python2.7/dist-packages/ to 
>/usr/local/lib/python3.2/dist-packages/. The module was found by 
>python3.2 but crashed because it's not refactored for python 3. Maybe 
>you'll have better luck with the mythtv module(s).
>
>David

I have mixed results today with doing simple Python 2 to Python 3
conversions using the 2to3 tool.  One just worked (but it was pretty
simple), but another gives errors in string.format in Python 3 where
Python 2 just reported the error value returned by the XML parsing
function that was being called.  So I seriously doubt that a simple
2to3 conversion would work on all the MythTV Python packages.


More information about the mythtv-users mailing list