autoexec.py error when trying to run a radio stream on startup

  • Dear Community,

    this is my first posting here, so Hello Everyone!


    My search on this topic wasn't successful, so here's my question.

    I have libreelec 9.2.1. on my Raspi 4 and have an autoexec.py in the userdata folder, which looks like that:

    # ----

    import xbmc

    xbmc.executebuiltin('PlayMedia("/var/media/Music1.5.2020/bbc1xtra.strm")')

    # ----

    The .strm file does work with Kodi on Windows. In libreelec, however, I get the autoexec.py error instead of a working radio stream. I've been trying all sorts of syntax variances, none would work...

    I look very much forward to suggestions - Thanks!

  • Are you referring to a log file? If so, in what path should I look?

    What I can currently say is that each time Kodi starts, there pops up a black cross in a red circle next to the message 'autoexec.py error' ... Btw, same issue on my raspberry pi 3b. The paths were triple checked and the .strm files work with Leia on Win10. I wonder what I'm doing wrong...

    Any ideas are appreciated.

    • Official Post

    It seems like the context of autoexec.py is outside Kodi runtime, so the XBMC lib isn't usable from there.

    To start the script right, do this:

    • remove autoexec.py
    • create /storage/.config/autostart.sh with this content:
    Bash
    #!/bin/sh
    
    (
        python /storage/.kodi/userdata/scripts/start_music.py
    ) &
    • create the folder /storage/.kodi/userdata/scripts
    • create the file /storage/.kodi/userdata/scripts/start_music.py with this content:
    Python
    #!/usr/bin/python
    
    import xbmc
    xbmc.executebuiltin('PlayMedia("/var/media/Music1.5.2020/bbc1xtra.strm")')
  • Thank you so much for your help, Da Flex!

    No error message pops up anymore. But nothing happens after the start of Kodi. At first, I assumed that the radio streams did not start because the Wifi connection might not have been established at this early point. As an alternative, I tried to autostart a local mp3 file like you can see in my screenshot, but unfortunately, that won't work either. My next step would be to download and install libreelec from the scratch, even though that means I'll have to run through all my individual settings again. More generally, I wonder why autoexec.py shouldn't work on my systems. I have only few addons installed and barely touched the system's config files...

  • Hate to say it, still no music playing...


    Edit:

    I installed from scratch. The Windows method haha... Now autoexec.py runs like a charm. I have no clue how I messed up the previous system

    Edited 2 times, last by LinusLibrary (June 6, 2020 at 9:01 PM).