How to Autorun/Autostart Your Python Script in the Raspberry Pi OS

  Рет қаралды 53,318

BaldGuyDIY

BaldGuyDIY

4 жыл бұрын

In this video I'll show a simple and effective method to autorun or autostart your python script. We will create a .desktop file in the home/pi/.config/autostart folder, with the following minimum lines:
[Desktop Entry]
Exec= python3 /home/pi/Desktop/guiautorun.py
Make sure to change the path in the Exec line to the location for your own python script.
Good luck! If you found this information helpful, please like the video and subscribe to the channel for more valuable content:)
Follow me on Twitter: @BaldGuyDIY
Send me an email: brandon@baldguydiy.com

Пікірлер: 334
@lpxharry1269
@lpxharry1269 4 ай бұрын
Literally a life saver. Thanks for showing the hidden files thing was going crazy trying to find .config
@jasonbills5347
@jasonbills5347 3 жыл бұрын
Phew, I tried like 5 different youtube vids before I found this one that actually works. Thanks!
@BaldGuyDIY
@BaldGuyDIY 3 жыл бұрын
Glad it could help! Thanks for watching.
@Wyatt-Barton
@Wyatt-Barton Жыл бұрын
This made my life so much easier than I thought it would be to get this to work! You the man now dawg!
@JohnDoe-vs9fm
@JohnDoe-vs9fm Жыл бұрын
FINALLY a working method ! I've tried all the other "easy" ways but none did work as well as this one. From a balding guy to another, thanks man!!
@fabioESER
@fabioESER 3 жыл бұрын
At last, something that really works. After hours of testing different forms, this gets the job done. Thank you very much for sharing it with us. Greetings from Portugal!
@BaldGuyDIY
@BaldGuyDIY 3 жыл бұрын
Glad it could help. Thanks for watching, and it’s amazing to think my little channel found someone in Portugal!
@Alarm451
@Alarm451 3 жыл бұрын
Thank you so so much, so many other videos don't make it clear that their methods don't work for desktop apps! This is exactly what I needed!
@BaldGuyDIY
@BaldGuyDIY 3 жыл бұрын
Thanks for watching. So glad it worked for you!
@marksockett4993
@marksockett4993 8 ай бұрын
life saver! spent far to long working on this. worked first time. thank you.
@martincook2908
@martincook2908 2 жыл бұрын
Fantastic, spent hours trying to get it to work, and you made it so easy.. just subscribed
@YashodSachintha
@YashodSachintha 3 жыл бұрын
Totally wanted 4 days to find this video. Thanks man. Works with shell scripts also. ❤️
@BaldGuyDIY
@BaldGuyDIY 3 жыл бұрын
Glad it was helpful! Thanks for watching.
@jayantbarthwal4470
@jayantbarthwal4470 2 жыл бұрын
Thank you so much for this tutorial, I never thought it would be this easy to do.
@jayaramkasi
@jayaramkasi 3 жыл бұрын
Omg spent so much time trying to make this work! You’re a life saver dude
@BaldGuyDIY
@BaldGuyDIY 3 жыл бұрын
That’s exactly how I felt! Thanks for watching.
@damianhockey8890
@damianhockey8890 Жыл бұрын
Honestly dude. Thank you so much for this. I'm currently working on a project that requires servos to boot up automatically and VLC playlist to start at the same moment. This has been a huge help. Subbed
@BaldGuyDIY
@BaldGuyDIY Жыл бұрын
Glad it was helpful. Good luck on your project!
@johnykast1
@johnykast1 2 жыл бұрын
Perfect! Thanks a lot BaldGuyDIY!!! This is actually the only possible way to make my FEH slideshow to run on startup. Great job!!
@cliveandrew3213
@cliveandrew3213 3 жыл бұрын
Thank you so much for that, I have been trying loads of stuff for ages, and yours finally works.
@BaldGuyDIY
@BaldGuyDIY 3 жыл бұрын
I’m glad it could help! Thanks for watching.
@Penzen11
@Penzen11 2 жыл бұрын
THANK YOU VERY MUCH! I must have been searching for exactly this answer since forever and three days.
@petervishton
@petervishton Жыл бұрын
It works! So very many other answers in this category did not. Thank you!
@TheRedstonelabz1
@TheRedstonelabz1 2 жыл бұрын
Absolute lifesaver 😅 i have tried all those methods in your list. Thanks mate!
@AAI30
@AAI30 2 жыл бұрын
After trying so many tutorials, one which even bricked my pi and I lost all my stuff,fortunately had a backup, this one actually worked. Thank you
@BaldGuyDIY
@BaldGuyDIY 2 жыл бұрын
So glad it helped! Thanks for watching.
@iftihossain6649
@iftihossain6649 2 жыл бұрын
Thank you for going through all the steps!
@finbenton
@finbenton 3 ай бұрын
Thanks, this is the only tutorial I found working, only thing I had to add was put "sudo" before python3 in Exec line because my application needed that to run.
@dylanmarcuswalsh
@dylanmarcuswalsh 2 ай бұрын
I dont think you realize how much this helped me, stopped me from spending another 2 Hours smashing my head into a wall, tysm
@nelsonaleon
@nelsonaleon 2 жыл бұрын
You are right, this is the only method that work for GUI. Thanks a lot
@Mcfrantzfrantz
@Mcfrantzfrantz 7 ай бұрын
Worked great - First time. Very simple and easy to follow. GREAT job!
@hasielmoreno7166
@hasielmoreno7166 2 жыл бұрын
I’ve been looking for this for WEEEEEEEKS My man you’re awesome! Thanks for sharing your findings!
@brassj67
@brassj67 2 жыл бұрын
Thanks for this. This is the only method I got to work properly!
@cristiancandia3538
@cristiancandia3538 3 жыл бұрын
Muchas gracias! Entre tanto buscar tu explicación me salvó la vida 😃
@BaldGuyDIY
@BaldGuyDIY 3 жыл бұрын
Thank you for watching!
@vanowarna
@vanowarna 2 жыл бұрын
This is really useful. Thank you very much !
@thomasstriegel8072
@thomasstriegel8072 3 жыл бұрын
Thank you sooo much! I was looking for months, to find a solution like this. And it turns out one more time: The most genius things are simple! (You just have to know "how" ;-)). Vielen Dank!!
@BaldGuyDIY
@BaldGuyDIY 3 жыл бұрын
Glad it was helpful! Thanks for watching.
@juniornewtons8066
@juniornewtons8066 3 жыл бұрын
Works for me tested with tkinter python file. You are the best.
@BaldGuyDIY
@BaldGuyDIY 3 жыл бұрын
Glad it was helpful. Thanks for watching!
@ShreyasTambo
@ShreyasTambo 10 ай бұрын
love you man couldnt find gui startup anywhere else
@adityadadgal5595
@adityadadgal5595 2 жыл бұрын
Thank you bro because of your vdo my final year project got successfully done 🙏🙏🙏👍🏻
@thegalacticelite
@thegalacticelite 3 жыл бұрын
Thank you! Thank you! Thank you! I was on the verge of giving up.
@BaldGuyDIY
@BaldGuyDIY 3 жыл бұрын
Glad it was helpful. Thanks for watching!
@CreativeBrainsOrganization
@CreativeBrainsOrganization 3 жыл бұрын
I thought I was just wasteing time watching this tutorial but this actually worked!!!!! Thankyou for spending your time for making this video😁😁
@BaldGuyDIY
@BaldGuyDIY 3 жыл бұрын
Thank you for watching! Glad it was not time wasted:)
@CreativeBrainsOrganization
@CreativeBrainsOrganization 3 жыл бұрын
@@BaldGuyDIY I wish I got this more earlier
@BaldGuyDIY
@BaldGuyDIY 3 жыл бұрын
@@CreativeBrainsOrganization That’s why I made the video! I thought if it took me several hours to find the answer, maybe I could save a few others some time. Turns out it was a LOT of others:)
@CreativeBrainsOrganization
@CreativeBrainsOrganization 3 жыл бұрын
@@BaldGuyDIY you are such an awesome guy. Expecting more from your side😁😁
@tambechristian
@tambechristian 2 жыл бұрын
Thank you! It works on the new raspios bullseye os, which is a bit different than previous ones.
@EmmanuelChanda-rd3od
@EmmanuelChanda-rd3od Жыл бұрын
As of 2023, definitely wealth the time.Worked for me 💯👌🏽 and I he said for scripts that need to run on the rasp pi desktop.
@bitshift264
@bitshift264 2 жыл бұрын
Thanks my friend. Finally got it worked!
@rcbuildmaster6192
@rcbuildmaster6192 10 ай бұрын
finally got running my server script thanks man
@SuperSamaku
@SuperSamaku 3 жыл бұрын
OHH MY GOD I was looking for 3 days to an autostart solution. YOU ARE MY HERO RIGHT NOW!!!
@BaldGuyDIY
@BaldGuyDIY 3 жыл бұрын
I’m so glad it was helpful:) Thanks for watching!
@joaomcs
@joaomcs Жыл бұрын
Thank you from Portugal for sharing your script 🍓
@yevgenytnc
@yevgenytnc 2 жыл бұрын
Thanks for the very helpful video @BalGuyDIY Those having issues: try ensuring you have no spaces in either the file path or the file itself
@BaldGuyDIY
@BaldGuyDIY 2 жыл бұрын
Thanks for watching and sharing good advice!
@chawesspe3
@chawesspe3 5 ай бұрын
I know I am late for the party, I'm just glad to show up. After investing hours in trying to make a stupid LED flash at startup, your video solved my problem. How did the world function before online videos? Thank you BaldGuyDIY, Charles
@julesw4240
@julesw4240 3 жыл бұрын
You just saved me ! This is the only method that worked for me !
@BaldGuyDIY
@BaldGuyDIY 3 жыл бұрын
I’m glad it worked. Thanks for watching!
@kevinwright7931
@kevinwright7931 2 жыл бұрын
Thank you very much, It works!! I have tried other ways to a gui to start on boot up. I made a gui for the ir blaster so I can use it with the Raspberry Pi touch screen.
@m_aenu
@m_aenu Жыл бұрын
OMG Thank you. Finally it works!
@r0adk1ll88
@r0adk1ll88 9 ай бұрын
Great Video. Thank you so much for saving me tons of heartache
@ZeeOut9
@ZeeOut9 3 жыл бұрын
It works for Raspberry Pi 4 Thank you!
@BaldGuyDIY
@BaldGuyDIY 3 жыл бұрын
It does! I’ve used it myself now too. Thanks for watching and commenting.
@mohammadsamer4541
@mohammadsamer4541 3 жыл бұрын
Thank you for this great tutorial !! As you mentioned all the other methods were not perfectly running especially for the graphical desktop OS When I tried your method it started only one time perfectly at startup but then it did not So I found that the problem is the path of the python script that it should be at /home/pi/GUI_SCRIPT.py not at /home/pi/Desktop/GUI_SCRIPT.py and this solved the problem in my case then the script is now autostarting every time I boot up my Raspberry Pi :D Thanks again for your amazing tutorials :)
@BaldGuyDIY
@BaldGuyDIY 3 жыл бұрын
Thanks for watching and commenting! It just depends on where you’ve saved your script what the path should be. Mine was saved to the desktop, so that’s why it worked for me. If yours was saved to the Pi folder, that explains the need for the oath to be edited. Thanks for watching!
@okrimtech
@okrimtech 3 жыл бұрын
@@BaldGuyDIY Hey! First of all, thank you so much for this tutorial, it worked for me too. However, I had the same problem as Mohammad. No matter where I put my scrip and how I described the path, it would only work if I dumped my script into the /home/pi folder. Strange. Anyways, thank you once again! :)
@BaldGuyDIY
@BaldGuyDIY 3 жыл бұрын
@@okrimtech I’m glad it worked, and that’s good feedback. I usually start scripts that are on the desktop so I haven’t played with other folders.
@WarDen77
@WarDen77 2 жыл бұрын
You are my hero today!!!
@BaldGuyDIY
@BaldGuyDIY 2 жыл бұрын
Glad it was helpful. Thanks for watching!
@bennyintheshed7821
@bennyintheshed7821 3 жыл бұрын
It verks! It's verking!! Thanks very much for this, saved me a heap of time :-)
@BaldGuyDIY
@BaldGuyDIY 3 жыл бұрын
So glad it helped. Thanks for watching!
@TechiReel
@TechiReel 2 жыл бұрын
fuck man you saved my one more day from running ... doing rnd whole day tried everything and finally this method work ... thanks man
@muralidharcc655
@muralidharcc655 3 жыл бұрын
very very very helpful information. thank you
@BaldGuyDIY
@BaldGuyDIY 3 жыл бұрын
You’re welcome! Thanks for watching, good luck on your projects.
@ricardomartinezramos796
@ricardomartinezramos796 2 жыл бұрын
You are awesome. Thank you for you video and your time.
@eilufoye
@eilufoye 3 жыл бұрын
Thank you! your videos are the best .
@BaldGuyDIY
@BaldGuyDIY 3 жыл бұрын
Thanks for watching and the kind words!
@krstech1269
@krstech1269 Жыл бұрын
Finally it works, thank you
@mlungisindlela6810
@mlungisindlela6810 2 жыл бұрын
Thanks man. Im gonna use this.
@asdasdasasdasdas9073
@asdasdasasdasdas9073 3 жыл бұрын
i love you for this tutorial, thanks!
@BaldGuyDIY
@BaldGuyDIY 3 жыл бұрын
Thanks for watching!
@endrekocsis5686
@endrekocsis5686 Жыл бұрын
huh, finally! - thank you, this helped a lot!!!
@claudioquinones5107
@claudioquinones5107 3 жыл бұрын
Thanks Guy , perfect!!!! autorun file is working OK!
@BaldGuyDIY
@BaldGuyDIY 3 жыл бұрын
Claudio Quiñones Glad it could help. Thanks for watching!
@programmerarnab9046
@programmerarnab9046 3 жыл бұрын
I was searching for this video and i looked around 30 videos to find exactly this video from this particular creator :P...
@BaldGuyDIY
@BaldGuyDIY 3 жыл бұрын
Thanks for watching, glad it was helpful!
@programmerarnab9046
@programmerarnab9046 3 жыл бұрын
@@BaldGuyDIY sure it was
@antonviorel
@antonviorel 2 жыл бұрын
It really worked! Thanks!
@ElectroniXforu
@ElectroniXforu 3 жыл бұрын
Thanks, finally problem resolved
@BaldGuyDIY
@BaldGuyDIY 3 жыл бұрын
Glad it worked! Thanks for watching.
@shreyas441
@shreyas441 Ай бұрын
thank you boss you saved my time!
@1984maduwantha
@1984maduwantha 3 жыл бұрын
very helpful. thank you lot. saving the my time
@BaldGuyDIY
@BaldGuyDIY 3 жыл бұрын
Glad it could help. Thank you for watching!
@lebhafterLebkuchen
@lebhafterLebkuchen 3 жыл бұрын
it finally works out! thanks a lot! :)
@BaldGuyDIY
@BaldGuyDIY 3 жыл бұрын
Glad it worked. Thanks for watching!
@kevinzywicki6920
@kevinzywicki6920 2 жыл бұрын
You are an angel sir
@ganda673
@ganda673 3 жыл бұрын
Thank you so much for this I can finally start my script at sartup.
@BaldGuyDIY
@BaldGuyDIY 3 жыл бұрын
Nice! Thanks for watching:)
@manish6743
@manish6743 3 жыл бұрын
Thank you so much for the video. Can we interrupt the python program while it's being executed, like say in case of an infinite loop?
@RichPendlebury
@RichPendlebury 3 жыл бұрын
Just like you eluded to at the start of the video. I have been searching high and low for an answer! This worked perfectly. I need a total of 8 .py files to open at once!
@RichPendlebury
@RichPendlebury 3 жыл бұрын
Although I’ve hit a few snags. The .py files I’m loading are GUI’s created in QtDesigner .. when I use this method none of the assets load with it. (I have images in a sort of slideshow format that display with a button click) any thoughts on why they don’t load?
@BaldGuyDIY
@BaldGuyDIY 3 жыл бұрын
@@RichPendlebury I haven’t created anything in QT Designer, only PySimpleGUI. Does it work without the auto run?
@BaldGuyDIY
@BaldGuyDIY 3 жыл бұрын
Thanks for watching! Glad it could be helpful. It was such a relief when I found it myself.
@RichPendlebury
@RichPendlebury 3 жыл бұрын
@@BaldGuyDIY normally I have to run it through the terminal which works properly. When I use your method .. it opens but just doesn’t load the images I need to display
@BaldGuyDIY
@BaldGuyDIY 3 жыл бұрын
What if you run it in the desktop environment from Thonny? If it runs correctly there, it should run fine from the auto run. The only other thing I can think of if that’s the case is that it might take time for something to be initialized on boot before it would work. In that case, build a little sleep delay into the start of the scripts and it should work fine. And if one script needs to be running before the others, sleep delay would work well. Or use one script to import the others in the order you need them and call them at the right time.
@AnandhuAK
@AnandhuAK 2 жыл бұрын
thanks bro, my problem solved...
@mahdokhtshahshaei6013
@mahdokhtshahshaei6013 Жыл бұрын
It works!!! you are a life saver :))
@phamhung5062
@phamhung5062 10 ай бұрын
thanks sir, your video very useful
@kivircikteknoloji
@kivircikteknoloji Жыл бұрын
thank u very much, it worked
@sasquashownz1
@sasquashownz1 Жыл бұрын
Mate u are a legend thank u. One more question - if i want this script to run every 20 minutes how would you do this, because i’m presuming the other methods that get suggested will run into the same issue of not working
@refereeweb5304
@refereeweb5304 3 жыл бұрын
That was a lifesaver video...
@BaldGuyDIY
@BaldGuyDIY 3 жыл бұрын
Glad it was! Thanks for watching.
@refereeweb5304
@refereeweb5304 3 жыл бұрын
@@BaldGuyDIY yeah... trying the same thing on a raspberry 4 right now.. but seems nothing is happening..
@BaldGuyDIY
@BaldGuyDIY 3 жыл бұрын
@@refereeweb5304 Try adding Terminal=True to the .desktop file and see if you get any output in the terminal window that would help diagnose the problem.
@MIDO_0707
@MIDO_0707 3 жыл бұрын
Thank you very very very much . It worked 100% ...
@BaldGuyDIY
@BaldGuyDIY 3 жыл бұрын
Awesome! Thanks for watching:)
@faryzryz1482
@faryzryz1482 3 жыл бұрын
Wow. Thank you sir
@BaldGuyDIY
@BaldGuyDIY 3 жыл бұрын
Thanks for watching! Glad it was helpful.
@AiBeast
@AiBeast 3 жыл бұрын
❤️ i was finding for linux 🔥🔥
@BaldGuyDIY
@BaldGuyDIY 3 жыл бұрын
Thanks for watching, glad it could help.
@VishalPatel1327
@VishalPatel1327 2 жыл бұрын
awsome Time saving tutorial
@gazouz6035
@gazouz6035 2 жыл бұрын
Thank you very much
@MikeSimon
@MikeSimon 7 ай бұрын
Thank You!!!
@mszivatz
@mszivatz 2 жыл бұрын
Thank you! It works :-)
@nabukodosonorogi9025
@nabukodosonorogi9025 6 ай бұрын
thank you so much man sooooo much
@philipm1896
@philipm1896 3 жыл бұрын
Works like a charm 😉
@BaldGuyDIY
@BaldGuyDIY 3 жыл бұрын
Glad it could help! Thanks for watching.
@siddharthareddy2006
@siddharthareddy2006 2 жыл бұрын
Thank you for the solution❤️❤️
@BaldGuyDIY
@BaldGuyDIY 2 жыл бұрын
Thanks for watching!
@fabimawn
@fabimawn 2 жыл бұрын
Fantastic!
@ericgorder1
@ericgorder1 Жыл бұрын
Thanks alot!
@MyChico2012
@MyChico2012 3 жыл бұрын
thanks bald guy \o/
@hyungjoong_k
@hyungjoong_k 4 жыл бұрын
thanks a lot, saved my life
@BaldGuyDIY
@BaldGuyDIY 4 жыл бұрын
And here I thought I was being dramatic in the video when I said it was hard to find:) Glad to hear it could be life saving, thanks for checking out the video!
@hyungjoong_k
@hyungjoong_k 3 жыл бұрын
@@BaldGuyDIY yeah especially for linux noob like myself, the video solved the problem right away. Thanks!
@user-kq5cd7bd3o
@user-kq5cd7bd3o 3 жыл бұрын
Thank you so much!
@BaldGuyDIY
@BaldGuyDIY 3 жыл бұрын
Glad it was helpful. Thanks for watching!
@ownownjutt7446
@ownownjutt7446 2 жыл бұрын
realy use ful
@pedroc.guerrero8253
@pedroc.guerrero8253 3 жыл бұрын
Life-savior!! 🥃
@BaldGuyDIY
@BaldGuyDIY 3 жыл бұрын
Glad it was helpful!
@tamukavumbunu1485
@tamukavumbunu1485 2 жыл бұрын
Thank you!!
@aleisastia
@aleisastia 9 ай бұрын
i would give you 100000000000000000000000 likes if i could!! when everything else failed THIS WORKED!!!!!!
@expertonnn
@expertonnn Жыл бұрын
thanks a lot😁
@user-fz8vk1fz8x
@user-fz8vk1fz8x Ай бұрын
감사합니다. 당신의 영상 덕분에 제 문제를 해결할 수 있었습니다. 한국에서 :) Thank you for your video. I can solve my problem in Korea :)
@kyy.
@kyy. 3 жыл бұрын
hey, great video! It runs just like you stated in the video and to that i thank you! my use-case for this though is running it without having to boot up the gui, and previous methods such as crontab are not working D: any ideas?
@BaldGuyDIY
@BaldGuyDIY 3 жыл бұрын
I put 4 or 5 files that can be edited for command line boot into the video. I’ve used command line auto run only once, I was able to get it to work with one of those. Thanks for watching and good luck!
@user-jr5cp5xd7c
@user-jr5cp5xd7c 3 жыл бұрын
Thanks!
@Didanihaaaa
@Didanihaaaa 3 жыл бұрын
good job!
@BaldGuyDIY
@BaldGuyDIY 3 жыл бұрын
Thanks for watching!
@shrapster43
@shrapster43 Жыл бұрын
thank y7ou thank you, you are my hero
@carlosgil4343
@carlosgil4343 3 жыл бұрын
GREAT!! If you want to run in console, change: Exec=lxterminal -e "python3 /home/pi/Desktop/guiautorun.py" ALSO WORKS!!!!!!! Thank you
@BaldGuyDIY
@BaldGuyDIY 3 жыл бұрын
Thanks for watching and for the comment. I’m sure that’s helpful for some people:)
@briangkehoe
@briangkehoe Жыл бұрын
Thanks for the info, adding Terminal=true did not work for me but your method above using lxterminal works perfectly and now I can get my script running in a terminal on startup so I can monitor the script output
@sadiaafrin4498
@sadiaafrin4498 4 ай бұрын
Thanks a lot!!!!!!
How to Make a Raspberry Pi Program Start on Boot (systemd)
9:57
Robotics Back-End
Рет қаралды 31 М.
I run untested, viewer-submitted code on my 500-LED christmas tree.
45:17
Задержи дыхание дольше всех!
00:42
Аришнев
Рет қаралды 3,7 МЛН
路飞太过分了,自己游泳。#海贼王#路飞
00:28
路飞与唐舞桐
Рет қаралды 36 МЛН
The most important Python script I ever wrote
19:58
John Watson Rooney
Рет қаралды 176 М.
Sharper than the iPhone!
9:15
Jeff Geerling
Рет қаралды 550 М.
How to Run a Script on Startup for Raspberry Pi  //  EASY
2:56
Sam Westby Tech
Рет қаралды 73 М.
I use Drag and Drop to build modern Python Apps
14:08
Softlinks
Рет қаралды 61 М.
Become a shell wizard in ~12 mins
12:25
CODE IS EVERYTHING
Рет қаралды 235 М.
How to Setup a Raspberry Pi LEARNING Desktop (Linux, Hacking, Coding)
31:31
Why Are Open Source Alternatives So Bad?
13:06
Eric Murphy
Рет қаралды 588 М.
How to Autorun a Python Script on the Raspberry Pi
6:45
Grace Xing
Рет қаралды 36 М.
Start Python Programs as your Raspberry Pi boots up
4:54
TeCoEd
Рет қаралды 84 М.
哈哈这些娃娃可烦人了!#火影忍者 #佐助 #家庭
0:31
火影忍者一家
Рет қаралды 34 МЛН
Funny Fails 🤭🤭🤣 #failsvideo #shortsfails #funnyfails  #fails .
0:52
ДОМАШНЕЕ ЭСКИМО//ПРОВЕРКА РЕЦЕПТА ТИК ТОК
0:22
ОЛЯ ПЕРЧИК
Рет қаралды 1,4 МЛН