Trying to start a simple python script contains lodes up pygame window displaying text.
OS is Debian version: 12 (bookworm)
Python script location: /home/user/Desktop/py/main.py
First attempt:
sudo nano /home/user/.bashrc
then added these lines
python /home/user/Desktop/py/main.py
This didn't work so, I thought of starting the terminal at startup so that above code gets executed using:
mkdir -p /home/user/.config/lxsession/LXDE-pi
cp /etc/xdg/lxsession/LXDE-pi/autostart /home/user/.config/lxsession/LXDEpi/
sudo nano /home/user/.config/lxsession/LXDE-pi/autostart
Then added following lines to above file:
@lxterminal
but didn't work
Second attempt:
sudo nano /lib/systemd/system/sample.service
added following text:
[Unit]
Description=My Sample Service
After=multi-user.target
[Service]
Type=idle
ExecStart=python /home/user/Desktop/py/main.py
[Install]
WantedBy=multi-user.target
sudo chmod 644 /lib/systemd/system/sample.service
sudo systemctl daemon-reload
sudo systemctl enable sample.service
sudo reboot
This doesn't works
tough the same things works on raspi OS Debian (bullseye)[On pi 4B] but don't on Debian version: 12 (bookworm)[on pi 5]
OS is Debian version: 12 (bookworm)
Python script location: /home/user/Desktop/py/main.py
First attempt:
sudo nano /home/user/.bashrc
then added these lines
python /home/user/Desktop/py/main.py
This didn't work so, I thought of starting the terminal at startup so that above code gets executed using:
mkdir -p /home/user/.config/lxsession/LXDE-pi
cp /etc/xdg/lxsession/LXDE-pi/autostart /home/user/.config/lxsession/LXDEpi/
sudo nano /home/user/.config/lxsession/LXDE-pi/autostart
Then added following lines to above file:
@lxterminal
but didn't work
Second attempt:
sudo nano /lib/systemd/system/sample.service
added following text:
[Unit]
Description=My Sample Service
After=multi-user.target
[Service]
Type=idle
ExecStart=python /home/user/Desktop/py/main.py
[Install]
WantedBy=multi-user.target
sudo chmod 644 /lib/systemd/system/sample.service
sudo systemctl daemon-reload
sudo systemctl enable sample.service
sudo reboot
This doesn't works
tough the same things works on raspi OS Debian (bullseye)[On pi 4B] but don't on Debian version: 12 (bookworm)[on pi 5]
Statistics: Posted by jimbob89 — Thu Feb 01, 2024 10:52 am