First question: have you looked at Sections 8 and 9?
Second question: do you know what errors are being thrown?
Third question: which desktop backend are you using? See the script linked to in Section 2.2 if you don't know.
Due to missing information the rest of this reply is speculative.
Did you switch from Wayalnd to X11? If so did you reboot then re-enable VNC?
It probably does at least try to run you pythion script but it isn't trying to do so in the terminal. You've told it to do two things:
You're missing the opening [ but that could be a transcription error. Otherwise see above.
Probably but see viewtopic.php?t=384126
No it shouldn't. $HOME is a shell variable that expands to your user's home directory. In this case /home/pi. $HOME/pi/ expands to /home/pi/pi which won't exist unless you created it and even if you did won't be searched during desktop start up.
/HOME/pi won't work either because the filesystem is case sensitive.
Guess what? See above.
Use raspi-config to switch back to the X11 desktop backend. Look under "Advanced Options".
Second question: do you know what errors are being thrown?
Third question: which desktop backend are you using? See the script linked to in Section 2.2 if you don't know.
Due to missing information the rest of this reply is speculative.
I have a problem auto-starting a python script in a terminal in a GUI environment.The computer is a RP5
pi@pi:~ $ hostnamectl
Static hostname: pi
Icon name: computer
Machine ID: 55f4e7a7065a45db8d3d96ff584e6f80
Boot ID: 1270837cdbdf497c8003ee01e945595d
Operating System: Debian GNU/Linux 12 (bookworm)
Kernel: Linux 6.12.34+rpt-rpi-2712
Architecture: arm64
I have read the the beginners guide for running a program at start-up , but was not succesfull.
First I started with section 5 , Full desktop with X11.
This configuration yields a gray screen when used in headless mode.
Did you switch from Wayalnd to X11? If so did you reboot then re-enable VNC?
Section 6 Wayland/wayfire
Autostart via wayfire.ini
I added the following to the wayfire.ini file :
[autostart]
terminal=lxterminal
command=python3 /home/pi/myscript.py
This just yields a terminal window , but does run the python script. Also the beginner guide does not clarify what
can be used as unique id = some command to run a script
It probably does at least try to run you pythion script but it isn't trying to do so in the terminal. You've told it to do two things:
- Start lxterminal
- Start your python script
Code:
[autostart]my-python-script=lxterminal -e python3 /home/pi/myscript.pyAutostart via a .desktop file
I created a new file in /home/pi/.config/autostart named myscript.desktop
Desktop Entry]
Type=Application
Exec=lxterminal
Exec=python3 /home/pi/Desktop/myscript.py
If I omit the last line the terminal window is started, otherwise no terminal appears.
You're missing the opening [ but that could be a transcription error. Otherwise see above.
Section 7 Wayland/labwc
Autostart via wayfire.ini
Same behavior as Section 6 Wayland/wayfire
Section 7.1.1.3
Usage
1. Open $HOME/.config/labwc/autostart should be $HOME/pi/.config/labwc/autostart
No it shouldn't. $HOME is a shell variable that expands to your user's home directory. In this case /home/pi. $HOME/pi/ expands to /home/pi/pi which won't exist unless you created it and even if you did won't be searched during desktop start up.
/HOME/pi won't work either because the filesystem is case sensitive.
Autostart via a .desktop file
Same behavior as Section 6 Wayland/wayfire
Guess what? See above.
With the previous OS you could have an autostart file with e.g. @lxterminal python3/home/pi/myscript.py , so how do I get that same functionality with bookworm ?
Use raspi-config to switch back to the X11 desktop backend. Look under "Advanced Options".
Statistics: Posted by thagrol — Tue Sep 02, 2025 12:04 am