My python script not running via autostart.sh

Hi all,

In /storage/.config/autostart.sh exists line for running my python script:

/storage/script.py

But after reboot CE device script don’t do anything. When I run it directly from CLI everything is fine:

./script.py

I also tried in autostart.sh this lines:
(python /storage/script.py)
and
./storage/script.py

but unsuccessfully.

The main question here is what does this script do.

Take content of 1 text file and insert value to remote database.

Then I would assume the network is not yet up. Try

(
  # maybe some sleep needed
  sleep 5
  python /storage/script.py
)&

thank you for advice! () & required or possible to use only sleep + python /storage/script.py ?

If you use ()& then this block is run in background and kodi can start immediately. If not kodi will start only when script ends.

I used even sleep 10 and ()& but unfortunately python script did not run. Any ideas?

Hard to tell without seeing the script. Put some logs in it and save them to file.

chmod 775 ./storage/script.py

Unfortunately after chmod 775 script.py doesn’t run also.

Why not showing the script and your problem will be solved asap. Without this it is just guessing.

Did you put some logs in your script to follow execution? Seems not…

#!/usr/bin/env python3
long content

please give me an example for python log code; although script running successfully by manual via CLI…

In CoreELEC exists some system log where I can try to find info?

in PATH exists /usr/bin, so strange that script can only be run manually without autostart.sh:

env | grep PATH

LD_LIBRARY_PATH=:/usr/lib/pulseaudio
PATH=/opt/bin:/opt/sbin:/usr/bin:/usr/sbin:/storage/.kodi/addons/service.aml-vnc/bin

successfully run

python3 script.py

but when

(script.py)&

-sh: ./storage/.config/script.py: not found

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.