Best way to start script AND tell it to use Python3?
Posted: Wed Feb 14, 2018 7:19 am
i currently have a script that i think isnt using python3 as the default interpreter to open my .py file
i use this .sh file and code entered in /etc/rc.local so that it starts up when the pi does but i want to know if its possible to force it to use Python3 for this script
and in /etc/rc.local
could i do something like this
in my .sh file ...
or would that not work? or is there a better way?
I use the .sh file to log an error if the Script wont start,
Should i just scrap the .sh file and run
in /etc/rc.local
i use this .sh file and code entered in /etc/rc.local so that it starts up when the pi does but i want to know if its possible to force it to use Python3 for this script
Code: Select all
#!/bin/sh
until /home/pi/usb-scanner/usb_scanner.py; do
date_time=$(date +"%Y-%m-%d %H:%M:%S")
echo "$date_time\t[Script]\tScript crashed with exit code $?. respawning...\n" | tee /dev/tty >> errors.log
sleep 1
done
Code: Select all
sleep 1
/home/pi/usb-scanner/usb_scanner.sh&
could i do something like this
in my .sh file ...
Code: Select all
#!/bin/sh
until sudo python3 /home/pi/usb-scanner/usb_scanner.py; do
date_time=$(date +"%Y-%m-%d %H:%M:%S")
echo "$date_time\t[Script]\tScript crashed with exit code $?. respawning...\n" | tee /dev/tty >> errors.log
sleep 1
done
I use the .sh file to log an error if the Script wont start,
Should i just scrap the .sh file and run
in /etc/rc.local
Code: Select all
(sleep 10;python3 /home/pi/usb-scanner/usb-scanner.py)&