There is a kid asking a question in the community, but I can't answer him because he has a restricted profile. Most likely It's an age restriction.
You can only see the post in the community, the link to the post will not show if I try to view it.
So if there is anyone that can respond it might be helpful to do so. Maybe have one of your kids pass on the answer?
Hi guys! I was wondering if you could help me out.
I'm trying to run synchronized_lights.py from one raspberry (A) on another (B). On A I use:
ssh p...@ip.address.pi'/home/pi/lightshowpi/py/synchronized_lights.py --file=/home/pi/audio.mp3'.
However, it returns:
Need to setup SYNCHRONIZED_LIGHTS_HOME environment variable, see readme
I've kept lightshowpi in the default folder and it works perfectly if I try to execute it locall yon B. I just can't get it to work via ssh from A. Any idea what I could try?
Thanks!
Answer
Issuing a command over ssh uses a Non-Interactive shell, so if the command relies on env variables it might fail. If you login over ssh and issue the command it works because when you login you start and Interactive shell and everything is set up correctly. To make it work the command looks like this
ssh pi@ip.address.pi "export SYNCHRONIZED_LIGHTS_HOME=/home/pi/lightshowpi && sudo python /home/pi/lightshowpi/py/synchronized_lights.py --file=/home/pi/audio.mp3"