RPI open a terminal on boot and auto-run a looping python script

Viewed 642

When my RPI3 is booted, I would like it to automatically have the terminal open with my python script already running. Note that it loops endlessly. I want to open the terminal so I check the logs my script produces.

I have searched ways that auto-runs python scripts on boots. I have tried putting python /home/pi/Desktop/pythonfile.py $ on /etc/rc.local but it just runs in the background and doesn't open a terminal.

What I also tried to do was use lxterminal. In /etc/rc.local, I put sudo /home/pi/Desktop/bashfile.sh &. Then the contents of bashfile.sh were:

#!bin/bash/

lxterminal --command="/bin/bash -c '/home/pi/Desktop/pythonfile.py; /bin/bash'"

When I try to manually run the bashfile.sh, the lxterminal opens and run the python script. However, when I rebooted, it doesn't open a terminal.

Any suggestions to this? Thanks.

0 Answers
Related