1

Please god can someone help me. I've just spent the last 8 hours trying absolutely everything I can find online in every different way I can possibly think of and none of it works. Chron jobs cant open a visual instance of the terminal I can see when i turn on the monitor connected to the pi no.

Various Autostart folders (apparently they're completely ignored by current versions of raspbian (11/bullseye) FFS who thought that was a good idea... no. rc.local runs before login so its useless to me no. .bashrc only works once I manually open an an instance of the terminal as well as rerunning the script every time you open a terminal NOT what I want on both counts.

I don't care how janky or against linux norms the solution is Ill even build my 'own' modified version of raspbian if that's what it takes and if i've somehow not done the things specified above properly please tell me how. I just want my script to be run in the directory it is saved in after login in such a way as I can see it visually on the screen with absolutely no input from me and it stays open after execution. Assume you're explaining your solution to a 3 year old who thinks linux is some sort of fruit and has absolutely no prior knowledge if you reference a file use the absolute path etc.

Side note this python script I've written opens and runs various other scripts and servers in subsequent terminal instances that persist after its been closed and I want the same functionality for the boot up script too. Please and Thank you

1
  • 2
    Get a simple python script working first eg "import time; print("hello world"); time.sleep(30)". I suspect your script may be throwing errors.
    – CoderMike
    Commented Aug 12, 2023 at 16:54

1 Answer 1

0

I generally use autostart to run python programs within a terminal window.

Edit the autostart file using Thonny:

sudo thonny /etc/xdg/lxsession/LXDE-pi/autostart

Add an @lxterminal entry as follows:

@lxpanel --profile LXDE-pi
@pcmanfm --desktop --profile LXDE-pi
@xscreensaver -no-splash
@lxterminal -e python3 /home/pi/hello.py

Assuming hello.py contains:

import time; print('hello world'); time.sleep(30)

You should see the following at startup:

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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