[mythtv] Using the python bindings

trisooma trisooma at xs4all.nl
Tue Mar 11 13:05:44 UTC 2008


If memory serves me well, you should import the bindings like so:

	from MythTV import MythTV
(maybe
	from MythTV import *)

and instantiate an object like so

	mythtv = MythTV()

You might want to try to use python interactively, like so

[trisooma at myhost ~]$ python
..python banner..
>>> import readline, rlcompleter
>>> readline.parse_and_bind('tab:complete')

now tab completion should work!

try importing MythTV and instantiating, and then try
>>> mythtv.<tab>

-----Oorspronkelijk bericht-----
Van: mythtv-dev-bounces at mythtv.org [mailto:mythtv-dev-bounces at mythtv.org]
Namens Ian Barton
Verzonden: dinsdag, 11 maart 2008 13:39
Aan: Development of mythtv
Onderwerp: [mythtv] Using the python bindings

I have written a jabber bot to return various bits of info about my backend.
It has been suggested that I should use the python bindings, rather than try
to access the database directly.

Can someone provide me with a bit of code that shows how to create an
instance of the MyhtTV class? This is my first python program, so please
excuse my stupidity:)

If I write something like:

try:
     from MythTV import MythDB
     mythdb = MythDB()

except:
     print "MythDB module cannot be initialized"

that works fine. However,

try:
     import MythTV
     mythtv = MythTV()

except:
     print "MythTV module cannot be initialized"

throws an exception.

Ian.
_______________________________________________
mythtv-dev mailing list
mythtv-dev at mythtv.org
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev





More information about the mythtv-dev mailing list