I’m running a fresh install of Rasbian Stretch on a raspberry3 and running the example flame python file on the Unicorn Hat. It looks lovely, but after I come back into the studio every morning, I find the animation has paused and I have to rerun the script to get it going again.
Note: I’m using the official raspberryPi power cable.
Any advice to ensure it runs continuously for long periods of time?
Do you see any debug output from the Python script when it’s stopped?
Has the script edited, or is it still running?
The first port of call would be to find out why it’s crashing- if you’re launching the script headlessly you need to pipe its output to a log file, like so:
python myscript.py > logfile.txt 2>&1
This redirects both the STDOUT (standard output) and STDERR (standard error output) of the Python script to the file logfile.txt. Hopefully when it crashes you’ll see some useful information here.
ok, hmm, thanks for the super quick responses @gadgetoid though. I’ll await to see the logfile fill with details and will report back (probably tomorrow morning).
I have to admit, I’m still a relative newbie when it comes to the terminal and python, but absolutely loving it. On the temperature side, I guess I could run a script such as https://projects.raspberrypi.org/en/projects/temperature-log and see if there’s any correlation.
Aha, if you’re starting it like that via an SSH session it will still be attached to your controlling terminal, so when the SSH session dies, the application goes with it.
Amazing amazing reply @gadgetoid! :D Although, Im still slightly scratching my head as to why my unrelated node.js scripts don’t fall over when my ssh terminal closes.
I’ve just got round to trying this and it all works a charm! Amazing. I tested terminating the shh connection and the flame immediately stopped. Sorry that I didn’t think of this before.
On the plus side, I love the mini start-up script tutorial you’ve posted. So so helpful! Bookmarked and faved.
You’re welcome- I need to whip up a more detailed tutorial on systemd scripts, there’s an awful lot involved in them that, for stuff like firing up a Python script, you can totally ignore. A few boiler plate examples have got me by pretty well for all but the most obtuse of scripts/dependencies.