Kodi Community Forum
Help setting up python/XBMC scripting environment? - 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: Help setting up python/XBMC scripting environment? (/showthread.php?tid=169139)



Help setting up python/XBMC scripting environment? - mwkurt - 2013-07-15

Hello,

I have done a bit of searching here in the forum and on the web and have not found very much that is very current in my quest.

What I have is Python 3.32, PyScripter and XBMC on my Windows PC.

I would like to dissect some XBMC scripts to help me better understand the ins and outs of python coding as well as scripting for XBMC, but alas, I am lost.
I know that I have to, in the code, import xbmc.py and xbmcgui.py. I have done that but how do I make the code I am looking at in PyScripter see the modules I am importing? Is it as simple as opening the py files up with PyScripter so that they are on a tab?
Could someone possibly tell what I need to do or point me to valid url that could help me set up my system?

Thanks,
Mark


RE: Help setting up python/XBMC scripting environment? - wsnipex - 2013-07-15

the xbmc specific modules only work when the addon/script is run inside xbmc.
And xbmc uses python 2.6 (or 2.7).


RE: Help setting up python/XBMC scripting environment? - mwkurt - 2013-07-16

(2013-07-15, 21:59)wsnipex Wrote: the xbmc specific modules only work when the addon/script is run inside xbmc.
And xbmc uses python 2.6 (or 2.7).

So how is a script for XBMC tested outside of XBMC in an IDE? Or are you saying it can't be? How is code tested before trying it out in XBMC? There has to be a way to write, test and debug code meant for an XBMC plugin, outside of the XBMC gui....doesn't there?

And. I have to use, at the most, 2.7 of Python?

Thanks,
Mark


RE: Help setting up python/XBMC scripting environment? - Karnagious - 2013-07-16

I tried to set this up, but its so convoluted and I am getting crashes I can't diagnose that I am back to inserting print statements to check the value of variables and watching the xbmc.log to find out why a script failed.

http://wiki.xbmc.org/index.php?title=HOW-TO:Debug_Python_Scripts_with_Eclipse


RE: Help setting up python/XBMC scripting environment? - mwkurt - 2013-07-16

Short of my above questions, Is there any way to run an XBMC script and step through the code to watch it's execution performed in real time?

Thanks,
Mark


RE: Help setting up python/XBMC scripting environment? - sphere - 2013-07-16

You can develop your add-on (if its a "plugin" type add-on) using xbmcswift.
Xbmcswift mocks all xbmc modules so that you can use any IDE you like. Also swift provides you with a nice plugin CLI.
If you want to see some real life xbmcswift based add-ons have a look to my github page...


RE: Help setting up python/XBMC scripting environment? - mwkurt - 2013-07-16

(2013-07-16, 15:34)sphere Wrote: You can develop your add-on (if its a "plugin" type add-on) using xbmcswift.
Xbmcswift mocks all xbmc modules so that you can use any IDE you like. Also swift provides you with a nice plugin CLI.
If you want to see some real life xbmcswift based add-ons have a look to my github page...

Sphere,

Thank you so much!!!!

Why does this seem to be such a secret? I can't wait to try it out later.

Thanks again,
Mark


RE: Help setting up python/XBMC scripting environment? - sphere - 2013-07-16

(2013-07-16, 16:31)mwkurt Wrote: Why does this seem to be such a secret? I can't wait to try it out later.

It's not a secret - it's just not popular Wink
But (sorry to say that) most add-on "developers" don't care python- or "good" code in general, they just take a random plugin, hack it to their needs and are done (which obviously works).