On older release of OS I simply run commandadd aditional lineCode:
sudo nano /etc/xdg/lxsession/LXDE-pi/autostart
And that's it, main.py was started after rebootCode:
@lxterminal -e python3 /home/vlado/Project/main.py
With Bookworm OS I have to do three steps
Line 1: moove to folder Project
Line 2: activation of the virtual environment
Line 3: start of the script main.pyWhen done it manual, it works normally. The question is how to do it to start script automaticaly after reboot?Code:
vlado@raspberry:~ $ cd Projectvlado@raspberry:~/Project $ source env/bin/activate(env) vlado@raspberry:~/Project $ python main.py
I did try like below, but no luck.
Any help would be appreciated.Line 4: activation of the virtual environmentCode:
sudo nano /etc/xdg/lxsession/LXDE-pi/autostart
Line 5: start of the script main.pyCode:
@lxpanel --profile LXDE-pi@pcmanfm --desktop --profile LXDE-pi@xscreensaver -no-splash@lxterminal -e python3 /home/vlado/Project/source env/bin/activate@lxterminal -e python3 /(env)home/vlado/Project/python main.py
No need to activate the venv, just use the full path for the venv's Python interpreter
Code:
@lxterminal -e /home/vlado/Project/env/bin/python3 /home/vlado/Project/main.py
Also the (env) is not part of the path,mit is just shown in the prompt. So that would never work.
Statistics: Posted by memjr — Tue Jan 30, 2024 5:40 am