Kodi Community Forum
xbmcgui - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=26)
+--- Thread: xbmcgui (/showthread.php?tid=176814)



xbmcgui - oki_eng - 2013-10-29

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


RE: xbmcgui - robweber - 2013-10-29

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


RE: xbmcgui - oki_eng - 2013-10-29

Thanks man,


RE: xbmcgui - bossanova808 - 2013-10-30

You can also use this new python library to do that sort of thing via json

http://forum.xbmc.org/showthread.php?tid=176672