xbmcgui
#1
Hi everyone,
I wrote simple python code at /home/test.py location. I gave permission with

chmod a+x test.py

I setup cron working every minute with below code

*/1 * * * * /usr/bin/python /home/tesy.py

I tested this code under confluence as a script addons this is working w/o any problem.

On the XBMC home screen this code and cron give a message box every single minute.

But, problem is python not find xbmc, xbmcgui or xbmcplugin. What you think? Do you have any idea what's going on?



TEST.PY
------------------------------------------------------
import xbmc, xbmcplugin, xbmcgui

class MainClass(xbmcgui.Window):
def __init__(self):
self.message('Hi There')

def message(self, message):
dialog = xbmcgui.Dialog()
dialog.ok("Ebru Player", message)


mydisplay = MainClass()
mydisplay .doModal()
del mydisplay
Reply
#2
The xbmc python modules are only loaded when you run a script from within XBMC. Generically calling python from the command line will not load them as they are not regular python modules. There may be a hackery type way to get these loaded so a default python install can use them but I wouldn't recommend it.

You are better off calling the script from within xbmc and having it run that way. If it's something you need to have done on a timer you can checkout the CronXBMC addon: https://github.com/robweber/cronxbmc.git
Reply
#3
Thanks man,
Reply
#4
You can also use this new python library to do that sort of thing via json

http://forum.xbmc.org/showthread.php?tid=176672
Addons I wrote &/or maintain:
OzWeather (Australian BOM weather) | Check Previous Episode | Playback Resumer | Unpause Jumpback | XSqueezeDisplay | (Legacy - XSqueeze & XZen)
Sorry, no help w/out a *full debug log*.
Reply

Logout Mark Read Team Forum Stats Members Help
xbmcgui0