0

I was cruising thru the topics, but anyway can´t get it working.

I need to turn on this bash script:

export LD_LIBRARY_PATH=.
./mjpg_streamer -o "output_http.so -w ./www" -i "input_raspicam.so -x 640 -y 480 -fps 20 -ex night"

using python. I need a remote access to the Raspberry Pi, and writing this script to bash everytime I need to turn on the stream is just annoying. Any ideas how the code in python should look like?

Thank you guys.

Ryci
  • 1
  • 6
  • You can set environment variables in python https://stackoverflow.com/questions/5971312/how-to-set-environment-variables-in-python. If you ran it as a bash script it would export it from the script but that would only be visible to the script's child processes. Should there be a newline in there after the first `.`? – cdarke Jun 21 '17 at 08:23
  • @cdarke Thank you for your answer, gonna take a look at it. Yeah there should be a new line, my bad. – Ryci Jun 21 '17 at 08:30
  • You might also consider appending that variable to the .bashrc file of your Rasberry Pi user via a python script. – BoboDarph Jun 21 '17 at 08:41
  • Thanks @BoboDarph – Ryci Jun 21 '17 at 09:32
  • Also take a look at the `subprocess` standard module for running external programs. – cdarke Jun 21 '17 at 15:08

0 Answers0