Help a newbie out - first attempt in writing a script
#1
I'm trying to create a simple custom script, basically more or less following the examples from the docs.

To give context, I'm running Kodi on a Raspberry Pi 4 running Raspbian (without Gnome or any other GUI) and Kodi is installed from its official apt repositories (the latest provided is Leia 18.7). I basically automatically start Kodi in a screen session on startup and then my TV connected to the RPi4 via HDMI. My RPi4 is in a case called Argon One which has a small fan for cooling and some CLI tooling can expose the current temperature & the current fan speed and can regulate the fan speed based on the detected temperature. My goal is basically to write a plugin/script which will display the temperature & fan speed in Kodi's UI, in the top-right corner, or sth like that.

I have an addon.xml file and an addon.py file with the following contents.

xml:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="script.argonone" name="Argon One" version="0.0.1~alpha" provider-name="vodamark">
    <requires>
        <import addon="xmbc.python" version="2.1.0"/>
        <import addon="xmbc.gui" version="5.14.0"/>
        <import addon="xmbc.json" version="6.0.0"/>
        <import addon="xmbc.metadata" version="2.1.0"/>
        <import addon="xmbc.addon" version="12.0.0"/>
    </requires>
    <extension point="xmbc.python.script" library="addon.py">
        <provides>executale</provides>
    </extension>
    <extension point="xmbc.addon.metadata">
        <summary lang="en_US">Argon One Plugin</summary>
        <description lang="en_US">Provides information on Argon One Raspberry Pi case in Kodi's UI</description>
        <language>en</language>
        <platform>all</platform>
        <license>MIT</license>
    </extension>
</addon>

python:
import xmbcaddon
import xmbcgui

addon = xmbcaddon.Addon()
addon_name = addon.getAddonInfo('name')

xmbcgui.Dialog().ok(addon_name, "Hello")

When I zip this up and try to install the zip (I've enabled installing from external sources), I get this: "The dependency of xmbc.python version 2.1.0 could not be satisfied." Any help would be appreciated, I must be missing something obvious. Kodi's log file is here: https://paste.kodi.tv/izerijosus.kodi
Reply
#2
(2021-02-27, 11:26)vodamark Wrote: When I zip this up and try to install the zip (I've enabled installing from external sources), I get this: "The dependency of xmbc.python version 2.1.0 could not be satisfied."

A few things..

I'm not a developer for Kodi, and I have no idea which Raspbian (called RaspberryPi OS these days) version you are using, but Kodi 18 uses Python-2, while the new Kodi 19 is using Python-3. Version 2 does not seem to be available on your OS setup, or, perhaps it is incorrectly installed or set up.

RaspberryPi OS is developed by the Raspberry Pi (community) people, and Team Kodi has zero involvement in that. It is not our OS. I'd say your best bet would be is to contact them via their development forum(s).
Reply
#3
(2021-02-27, 11:26)vodamark Wrote: I'm trying to create a simple custom script, basically more or less following the examples from the docs.

To give context, I'm running Kodi on a Raspberry Pi 4 running Raspbian (without Gnome or any other GUI) and Kodi is installed from its official apt repositories (the latest provided is Leia 18.7). I basically automatically start Kodi in a screen session on startup and then my TV connected to the RPi4 via HDMI. My RPi4 is in a case called Argon One which has a small fan for cooling and some CLI tooling can expose the current temperature & the current fan speed and can regulate the fan speed based on the detected temperature. My goal is basically to write a plugin/script which will display the temperature & fan speed in Kodi's UI, in the top-right corner, or sth like that.

I have an addon.xml file and an addon.py file with the following contents.

[syntax=xml]<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="script.argonone" name="Argon One" version="0.0.1~alpha" provider-name="vodamark">
    <requires>
        <import addon="xmbc.python" version="2.1.0"/>
        <import addon="xmbc.gui" version="5.14.0"/>
        <import addon="xmbc.json" version="6.0.0"/>
        <import addon="xmbc.metadata" version="2.1.0"/>
        <import addon="xmbc.addon" version="12.0.0"/>
    </requires>
   

Try this instead and it should work for the Python dependency for Kodi 18:

        <import addon="xbmc.python" version="2.25.0"/>

For Kodi 19:

    <import addon="xbmc.python" version="3.0.0"/>

Here's a good link for the addon.xml format.  A secret for Python here is that this line really isn't required in most instances.   It's more of a best practice and safety check against certain Python code which is version specific.  I added the line to my Kodi 19 version of my addon but have never had a required line for Python in my Kodi 18 version.  If you want to play, try deleting the line and watch what happens.


Jeff
Running with the Mezzmo Kodi addon.  The easier way to share your media with multiple Kodi clients.
Service.autostop , CBC Sports, Kodi Selective Cleaner and Mezzmo Kodi addon author.
Reply
#4
(2021-02-27, 12:07)Klojum Wrote:
(2021-02-27, 11:26)vodamark Wrote: When I zip this up and try to install the zip (I've enabled installing from external sources), I get this: "The dependency of xmbc.python version 2.1.0 could not be satisfied."

A few things..

I'm not a developer for Kodi, and I have no idea which Raspbian (called RaspberryPi OS these days) version you are using, but Kodi 18 uses Python-2, while the new Kodi 19 is using Python-3. Version 2 does not seem to be available on your OS setup, or, perhaps it is incorrectly installed or set up.

RaspberryPi OS is developed by the Raspberry Pi (community) people, and Team Kodi has zero involvement in that. It is not our OS. I'd say your best bet would be is to contact them via their development forum(s).

(Sorry for the late reply. I enabled email notifications for this thread, but I didn't receive any.)

Both Python 2 & 3 are installed & working, installed normally thorugh apt repositories. There's no point of me asking people in RPi community, it has nothing to do with them. This problem is somehow linked to Kodi, its environment or its addon API.

Relevant outputs showing it:
Code:
$ uname -a
Linux raspberrypi 5.10.11-v7l+ #1399 SMP Thu Jan 28 12:09:48 GMT 2021 armv7l GNU/Linux

$ apt list --installed | grep python

libpython-stdlib/stable,now 2.7.16-1 armhf [installed,automatic]
libpython2-stdlib/stable,now 2.7.16-1 armhf [installed,automatic]
libpython2.7-minimal/stable,now 2.7.16-2+deb10u1 armhf [installed,automatic]
libpython2.7-stdlib/stable,now 2.7.16-2+deb10u1 armhf [installed,automatic]
libpython2.7/stable,now 2.7.16-2+deb10u1 armhf [installed,automatic]
libpython3-stdlib/stable,now 3.7.3-1 armhf [installed,automatic]
libpython3.7-minimal/stable,now 3.7.3-2+deb10u2 armhf [installed,automatic]
libpython3.7-stdlib/stable,now 3.7.3-2+deb10u2 armhf [installed,automatic]
libpython3.7/stable,now 3.7.3-2+deb10u2 armhf [installed,automatic]
python-apt-common/stable,now 1.8.4.3 all [installed,automatic]
python-bluez/stable,now 0.22+really0.22-1 armhf [installed,automatic]
python-crypto/stable,now 2.6.1-9+b1 armhf [installed,automatic]
python-dnspython/stable,now 1.16.0-1 all [installed,automatic]
python-gpg/stable,now 1.12.0-6 armhf [installed,automatic]
python-ldb/stable,now 2:1.5.1+really1.4.6-3 armhf [installed,automatic]
python-minimal/stable,now 2.7.16-1 armhf [installed,automatic]
python-olefile/stable,now 0.46-1 all [installed,automatic]
python-pil/stable,now 5.4.1-2+deb10u2 armhf [installed,automatic]
python-rpi.gpio/testing,now 0.7.0-0.1~bpo10+4 armhf [installed]
python-samba/stable,now 2:4.9.5+dfsg-5+deb10u1+rpi1 armhf [installed,automatic]
python-simplejson/stable,now 3.16.0-1 armhf [installed,automatic]
python-talloc/stable,now 2.1.14-2 armhf [installed,automatic]
python-tdb/stable,now 1.3.16-2+b1 armhf [installed,automatic]
python2-minimal/stable,now 2.7.16-1 armhf [installed,automatic]
python2.7-minimal/stable,now 2.7.16-2+deb10u1 armhf [installed,automatic]
python2.7/stable,now 2.7.16-2+deb10u1 armhf [installed,automatic]
python2/stable,now 2.7.16-1 armhf [installed,automatic]
python3-apt/stable,now 1.8.4.3 armhf [installed,automatic]
python3-certifi/stable,now 2018.8.24-1 all [installed,automatic]
python3-chardet/stable,now 3.0.4-3 all [installed,automatic]
python3-dbus/stable,now 1.2.8-3 armhf [installed,automatic]
python3-debconf/stable,now 1.5.71 all [installed,automatic]
python3-distro-info/stable,now 0.21 all [installed,automatic]
python3-gi/stable,now 3.30.4-1 armhf [installed,automatic]
python3-idna/stable,now 2.6-1 all [installed,automatic]
python3-minimal/stable,now 3.7.3-1 armhf [installed,automatic]
python3-pkg-resources/stable,now 40.8.0-1 all [installed,automatic]
python3-requests/stable,now 2.21.0-1 all [installed,automatic]
python3-rpi.gpio/testing,now 0.7.0-0.1~bpo10+4 armhf [installed]
python3-six/stable,now 1.12.0-1 all [installed,automatic]
python3-smbus/stable,now 4.1-1 armhf [installed]
python3-urllib3/stable,now 1.24.1-1 all [installed,automatic]
python3-yaml/stable,now 3.13-2 armhf [installed,automatic]
python3.7-minimal/stable,now 3.7.3-2+deb10u2 armhf [installed,automatic]
python3.7/stable,now 3.7.3-2+deb10u2 armhf [installed,automatic]
python3/stable,now 3.7.3-1 armhf [installed,automatic]
python/stable,now 2.7.16-1 armhf [installed]

$ python --version
Python 2.7.16

$ python2 --version
Python 2.7.16

$ python3 --version
Python 3.7.3

I still have to try out what jbinkley60 proposed. Although I think I tried with 2.25.0 first and then fell back onto 2.1.0 just to get the same message again. Although I will try once more, and once without that line altogether.
Reply
#5
So I did some testing on my RPI4 running LibreElec 9.2.6 which has Kodi 18.9 .  All options works with regards to the import python version.  I tried no entry, 2.1.0 and 2.25.0 .  All worked.  To ensure it was being read I tried 3.0.0 and got a dependency failure error.   While that doesn't match your configuration I wanted to pass it along.  It does seem to be something specific with Raspian and Kodi.  I suspect that even if removing the dependency works, you may likely run into other issues.


Jeff
Running with the Mezzmo Kodi addon.  The easier way to share your media with multiple Kodi clients.
Service.autostop , CBC Sports, Kodi Selective Cleaner and Mezzmo Kodi addon author.
Reply
#6
Thanks for trying it out! I'll try to figure out what's wrong then. Although it's weird, because Kodi comes with some plugins by default and those seem to work. So I don't know what's different with the one I made.😕
Reply

Logout Mark Read Team Forum Stats Members Help
Help a newbie out - first attempt in writing a script0