I am writing a python program with tkinter in RPI. I want to Autostart this program on boot, but it keeps error on: Error Message PS:I didn't using any matlab on this program.
Raspbian? I just used the autostart file to do this. Edit /home/pi/.config/lxsession/LXDE-pi/autostart
and add:
@/home/pi/path/to/myprogram.py
Be sure to include a shebang in your file. Then set the executable bit with this command:
chmod +x /home/pi/path/to/myprogram.py
Edit: That error looks like you are trying to run your program remotely, via ssh or something. I don't think that error is related to the autostart. If you want to run the program via ssh, you need to type this command first:
export DISPLAY=:0
This works for me:
cd /home/pi/.config/autostart
Then create new file:
sudo nano pythonprogramm.desktop
(you can replace "pythonprogramm")
And you write this in the new file:
[Desktop Entry]
Encoding=UTF-8
Type=Application
Name=pythonprogramm
#Exec=sudo idle /var/www/html/pythonprogramm.py
Exec=sudo /var/www/html/pythonprogramm.py
StartupNotify=false
Terminal=yes
Hidden=false
Reboot and it should work :)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.