[mythtv-users] running python scripts on OS X against mythtv database?

Bill Meek keemllib at gmail.com
Mon Nov 26 01:46:27 UTC 2018


On 11/25/18 5:24 AM, James Abernathy wrote:
> 
>> On Nov 24, 2018, at 4:53 PM, Bill Meek <keemllib at gmail.com <mailto:keemllib at gmail.com>> wrote:
>>
>> On 11/24/18 3:26 PM, James Abernathy wrote:
>>> I have some scripts that work on my Ubuntu systems that print data from the mythtv backend and database.
>>> I have a Macbook Pro that I run Mythfrontend and XQuartz for maintenance of the backend. I’d like to run some python scripts.
>>> How do I link up all the modules so I don’t get errors like:
>>>   File "./find_recording_inputs.py", line 13, in <module>
>>>     from MythTV import exceptions, MythBE
>>> ImportError: No module named MythTV
>>
>> If you know where the MythTV Python bindings are installed, then you can
>> do this:
>>
>> export PYTHONPATH=/directory/where/the/bindings/are/installed
>>
>> This would display the directories in use:
>>
>> echo -e "import sys\nfor p in sys.path:\n\tprint p" | python
>>
>> -- 
> 
> On my system the echo above shows this:
> 
> Abernathys-iMac:~ mlabernathy$ echo -e "import sys\nfor p in sys.path:\n\tprint p" | python
> 
> /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip
> /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7
> /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin
> /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac
> /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages
> /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python
> /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk
> /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old
> /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload
> /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC
> /Library/Python/2.7/site-packages
> 
> I have no idea where the bindings for mythtv are.

If you search on the forum, there a number of references to the
bindings being installed, like:

https://forum.mythtv.org/viewtopic.php?f=26&t=696&p=3377&hilit=python+bindings#p3377

But since I don't use/have a Mac, I'll sign off here.

If the Mac has a tool like ubuntu, you could do this:

locate -b "\MythTV" to find the directory where the
bindings are kept.

Also note the Wiki page (https://www.mythtv.org/wiki/MacPorts#Scripts)
mentioned and that scripts must be modified to point to the location
of Python itself: #!/opt/dvr/bin/python2.7

-- 
Bill


More information about the mythtv-users mailing list