Error with xbmcplugin.getSetting
#1
Hello again, Kodi community. I've been continuing to develop an add-on and I ran into an index error (list index out of range) while trying to get a setting from settings.xml. To get to the bottom of the problem, I stripped down the add-on to just the bare minimum functionality while still getting the same error.

addon.py:
python:
import xbmc, xbmcplugin, sys
if (__name__ == '__main__'):
    monitor = xbmc.Monitor()
    while not monitor.abortRequested():
        if monitor.waitForAbort(1):
            break
        testSetting = xbmcplugin.getSetting(int(sys.argv[1]), "testSetting")
        print(str(testSetting))
addon.xml:
xml:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="script.testing" name="Testing" version="0.0.2">
    <requires>
        <import addon="xbmc.python" version="3.0.0"/>
    </requires>
    <extension point="xbmc.python.script" library="addon.py">
        <provides>executable</provides>
    </extension>
    <extension point="xbmc.addon.metadata">
        <platform>all</platform>
        <license>GNU General Public License, v2</license>
    </extension>
</addon>

settings.xml (inside the resources folder, with labels defined in strings.po inside language/resource.language.en_gb):
xml:
<?xml version="1.0" ?>
<settings version="1">
    <section id="script.testing">
        <category id="allSettings" label="30001" help="">
            <group id="1">
                 <setting id="testSetting" type="integer" label="30002" help="">
                     <level>0</level>
                     <default>3</default>
                     <constraints>
                         <minimum>0</minimum>
                         <step>1</step>
                         <maximum>3</maximum>
                     </constraints>
                     <control type="slider" format="integer">
                         <popup>false</popup>
                     </control>
                </setting>
            </group>
        </category>
    </section>
</settings>

Here's the pastebin: https://paste.kodi.tv/ahuguloqim.kodi

Any help with troubleshooting this would be greatly appreciated. Thanks so much!
Reply
#2
in the addon.xml file, you have defined your addon as a script and not as a plugin.
since it's a script, you can not use xbmcplugin.getSetting().

you should be using either xbmcaddon.Addon().getSetting("testSetting")
or xbmcaddon.Addon().getSettingInt("testSetting")

the first one will return the setting value as a string, the second will return it as an integer.
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply
#3
Ah, that explains it. I'll use one of those commands instead. Thank you so much!
Reply

Logout Mark Read Team Forum Stats Members Help
Error with xbmcplugin.getSetting0