I am trying to find a way to open a terminal and run a program on boot using Raspberry Pi's newest Raspbian Jessie. I have tried to use the following:


[Desktop Entry]
Exec= lxterminal -e [Application python3] [home/pi/Raspberry_Pi_sample_code/i2c.py]

This just gives me a big blank terminal that I can't do anything with. Any advice would greatly appreciated. *Please also note that I have very limited experience with python and linux. Thank you.

  • You say, "newest Raspbian Jessie"... maybe that's what you meant, but I thought I'd mention that stretch is the latest version of Raspbian. It's been out for about 18 months now. – Seamus Jan 7 '19 at 23:45
  • Seamus thank you, I know that it was a slightly different version of Jessie that had been updated in November that was put on this Pi. I have very little experience with Raspberry Pi and linux... – Amber Taylor Jan 8 '19 at 14:53
  • That's fine, but you should be aware of the Long Term Support status of older releases. Know also that since the RPO "does its own thing" with respect to long term support, Raspbian Jessie may not be supported any longer – Seamus Jan 8 '19 at 17:49

Your Exec-section should look like: Exec=lxterminal -e "python3 /home/pi/Raspberry_Pi_sample_code/i2c.py".

Note that the terminal will close when your script is done. If you want to prevent that add ; bash to the command:

Exec=lxterminal -e "python3 /home/pi/Raspberry_Pi_sample_code/i2c.py ; bash"

If you start your script like this AND have Terminal=true in your .desktop file, it will start two terminals. So change it to false, or if lxterminal is your default terminal, it's enough to have Terminal=true in your .desktop file. Then you just need:

Exec=python3 /home/pi/Raspberry_Pi_sample_code/i2c.py or

Exec=bash -c "python3 /home/pi/Raspberry_Pi_sample_code/i2c.py ; bash".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.