Python Tutorial: Calling External Commands Using the Subprocess Module

  Рет қаралды 363,314

Corey Schafer

Corey Schafer

Күн бұрын

In this Python Programming Tutorial, we will be learning how to run external commands using the subprocess module from the standard library. We will learn how to run commands, capture the output, handle errors, and also how to pipe output into other commands. Let's get started...
✅ Support My Channel Through Patreon:
/ coreyms
✅ Become a Channel Member:
/ @coreyms
✅ One-Time Contribution Through PayPal:
goo.gl/649HFY
✅ Cryptocurrency Donations:
Bitcoin Wallet - 3MPH8oY2EAgbLVy7RBMinwcBntggi7qeG3
Ethereum Wallet - 0x151649418616068fB46C3598083817101d3bCD33
Litecoin Wallet - MPvEBY5fxGkmPQgocfJbxP6EmTo5UUXMot
✅ Corey's Public Amazon Wishlist
a.co/inIyro1
✅ Equipment I Use and Books I Recommend:
www.amazon.com/shop/coreyschafer
▶️ You Can Find Me On:
My Website - coreyms.com/
My Second Channel - / coreymschafer
Facebook - / coreymschafer
Twitter - / coreymschafer
Instagram - / coreymschafer
#Python

Пікірлер: 379
@coreyms
@coreyms 5 жыл бұрын
Hey everyone. I hope you found this video useful. As I mentioned in a previous post, I just finished renovating a house that I'm selling and am currently going through a cross-country move, so I haven't been able to post as much lately as I'd like. Once I get this house sold and get settled into my new place then I'll be releasing at a much faster pace. Thanks for your patience... especially those who are contributing through Patreon or are Channel Members! I appreciate all of you! Hope you're all having a great week!
@priteshugrankar6815
@priteshugrankar6815 5 жыл бұрын
Hi Corey, happy house shifting. Thank you for such amazing content. Would you also be coming up with golang videos? If so, it will be truly awesome.
@realplod
@realplod 5 жыл бұрын
Where are you moving?:)
@buacomgiadinh1
@buacomgiadinh1 5 жыл бұрын
Is there any intention for golang programming
@coreyms
@coreyms 5 жыл бұрын
realplod I’m moving from Colorado to North Carolina.
@undisclosedmusic4969
@undisclosedmusic4969 4 жыл бұрын
Good luck with the move! Also: Docker tutorials? ❤️
@jonathanhenyolson
@jonathanhenyolson 5 жыл бұрын
I know you have about a million things on your to-do list but a series or video on threading would be amazing. There's pretty sparse KZfaq content on it so far and one of your videos could easily fill that void! Thanks for all the great content!
@tanmoypaul1362
@tanmoypaul1362 4 жыл бұрын
I second this. A video on threading would be awesome.
@user-be8ud2qd2d
@user-be8ud2qd2d 4 жыл бұрын
@@tanmoypaul1362 Yeah I'd love this aswell
@Yasharvl
@Yasharvl 4 жыл бұрын
Corey, there's no doubt that these videos are a real must for anyone, who's learning Python.
@ibrahimal-mahfooz8737
@ibrahimal-mahfooz8737 4 жыл бұрын
Your content is as simple as sipping water for beginners. At the same time, I'm pretty sure it is so difficult to create and deliver such a clean and crystal clear content. Well done.
@coreyms
@coreyms 4 жыл бұрын
Thanks!
@Jack-sh4uv
@Jack-sh4uv 3 жыл бұрын
I just want to say how helpful all your videos are, I really would get so stuck on the occasional small thing but your videos are consistently well thought out and progress at a good speed. Thanks for the help
@I_Follow_Jesus
@I_Follow_Jesus 4 жыл бұрын
I've been taking Python courses online for certificates. Corey explains Python better that my online instructors.
@christianhaugen9462
@christianhaugen9462 3 жыл бұрын
You are one of my favorite youtubers. I really appreciate how clear you communicate these concepts and teach them so well. I'll always be subscribed to you Corey!
@bhushanhiwase121
@bhushanhiwase121 4 жыл бұрын
You are the best Corey, You have made my life so simple, and each one of your videos is so full of information and handy tricks. I really appreciate the work you put on to bring out these videos. Cannot be more Thankful... Huge Respect man...
@ItzSenaCrazy
@ItzSenaCrazy 5 жыл бұрын
This tutorial arrived on right time. I'm coding a program to manage all my VENVs. Thanks Corey!
@grjesus9979
@grjesus9979 3 жыл бұрын
This is what i can say linear learning look like, as it should always be, step by step and as clear as possible. Thank you a lot sir!
@martym2908
@martym2908 2 жыл бұрын
I googled a dozen didn't pages to get subprocess to work and haven't succeeded until i watched this. Thanks a ton !
@AndreyLLIaBepMa
@AndreyLLIaBepMa 4 жыл бұрын
Great tutorial! Magnificent library! Thank you, Coray! You are doing a great work!
@happy0memo
@happy0memo 2 жыл бұрын
Hi Corey, your video was fantastic! You were able to describe the content in a way that made sense. I have been trying to understand this for about 3 days now and your 19min clip nailed it to the point where i can simply grasp the concepts. In fact, i have been trying to solve a code problem and you helped me a lot. Great work and keep up the good content.
@avahsieh4645
@avahsieh4645 4 жыл бұрын
Your tutorial helps me more than the python official document does. Thank you.
@jasonhales262
@jasonhales262 Жыл бұрын
This is by far the best explanation of the subprocess module on the WHOLE INTERNET.
@nick.karimi
@nick.karimi 4 жыл бұрын
I found this video very useful. Had came across subprocess from the automate the boring stuff book but then didn't understand their purpose untill I watched this video. Have done really cool stuff with it, I had even to revisit the module from the book. In the end you've mentioned about Unicode, I haven't found a meaningful video on the topic and books full of jargons. I bet a video from you will be my saviour in understanding the topic. Thanks @Corey for the exceptional python tutorials.
@kaiwalyapethe2931
@kaiwalyapethe2931 5 жыл бұрын
Encode-decode strings, waiting for it.. Great work Corey! Thanks for the videos.
@carlosrivadulla8903
@carlosrivadulla8903 5 жыл бұрын
also how to encode an script but that still working when other user execute it to avoid copyright violation
@RinksRides
@RinksRides 2 жыл бұрын
Clear, concise, and great production quality! Subbed.
@kobas8361
@kobas8361 4 жыл бұрын
Love watching Corey's videos stoned. Being a programmer is so beautiful.
@youtuberecommended9183
@youtuberecommended9183 4 жыл бұрын
Love your helicopter!
@crackindenpockets6211
@crackindenpockets6211 4 жыл бұрын
i support marijuana use
@steez4778
@steez4778 3 жыл бұрын
@@youtuberecommended9183 bruh
@HK-sw3vi
@HK-sw3vi 3 жыл бұрын
how's watching his videos dead?
@peternau1346
@peternau1346 3 жыл бұрын
Unfortunately, you won't remember any of it.
@poles1c
@poles1c 4 жыл бұрын
Corey this was incredibly helpful, thank you!
@roboroogo
@roboroogo 4 жыл бұрын
Easily some of the best python content on you tube. Many thanks
@brijesh0808
@brijesh0808 4 ай бұрын
This video is far far better than any documentation, blog or video content whether on youtube or udemy.
@khushpatelmd
@khushpatelmd 2 жыл бұрын
Thank you so much Corey. I just want to let you know you are changing lives and the world with your amazing tutorials!
@geekchiq5431
@geekchiq5431 2 жыл бұрын
Thank You for sharing your knowledge with us! So grateful and appreciate your natural gift of teaching. I swear I was only looking for insight into using the subprocess module when you answered like 4 other questions I had! lol
@bloodywolftr
@bloodywolftr Жыл бұрын
Thank you very much Corey.This is exactly what I was searching for and you explained it in a nutshell.
@BhajanSansar
@BhajanSansar 3 жыл бұрын
Very helpful video. Just what i needed. Subscribed!
@tkadado
@tkadado 3 жыл бұрын
Fantastic tutorial! I got what I was looking for and more
@welltimeltduk10
@welltimeltduk10 3 жыл бұрын
Corey, you are such a good teacher. I really like your style of building up the concepts step by step in an easy and accessible way. If you had a Udemy course, I would most likely buy it just to enjoy the teaching method unraveling complex concepts in an easy manner right in front of my eyes :)
@jacquelineroronoad2254
@jacquelineroronoad2254 3 жыл бұрын
Yo this is incredibly helpful! I've been working on subprocess at work, but I didn't comprehend this library well and it was hard for me to complete my task!
@sumukhas5418
@sumukhas5418 Жыл бұрын
This is the best explanation of a code I have ever seen!!
@maxrodriguez643
@maxrodriguez643 3 жыл бұрын
Really useful! I am loving this subprocess module
@jamesgeevarghese5867
@jamesgeevarghese5867 Жыл бұрын
great video, really helped me understand the subprocess module and allow me to use it in my projects
@chiragpalan9780
@chiragpalan9780 3 жыл бұрын
Each time I search something about python and I found Corey.. Great.
@mayankpant5471
@mayankpant5471 3 жыл бұрын
this man makes everything very ez. python semantics itself are very ez but his videos makes learning python like learning alphabets.
@dilipsharan8699
@dilipsharan8699 3 жыл бұрын
Thank you very much for this tutorial. It really helped be get my head round running commands and error processing.
@RECHDIful
@RECHDIful 3 жыл бұрын
as usual top look up of a python library, got what i needed here :) thx Corey
@Hunt3rGatherer
@Hunt3rGatherer 6 ай бұрын
Man I watched this 3 years ago with zero knowledge of computers other than a beginner python course and my brain short circuited. I finally understand everything in this video lol. Been using your videos for years now thanks bro 🤙
@killuasama824
@killuasama824 4 жыл бұрын
Thank you, your lessons are the clearest one for us, many thanks!
@VikasGuptacherie
@VikasGuptacherie 5 жыл бұрын
Thanks Corey, very nice tutorial on another python built-in module. However I was expecting to see some more complex examples using Popen as well. Hope you cover it in future.
@papireddymaramreddy8964
@papireddymaramreddy8964 4 жыл бұрын
Awesome Corey.. very simplified.. Thanks a lot
@mcgriddletime915
@mcgriddletime915 3 жыл бұрын
This was phenomenally explained. Thank you sir.
@bluesquare23
@bluesquare23 Жыл бұрын
Thank you for explaining clearly with simple examples! I've been trying trying to read the docs and stack overflow. But videos are easier for just getting a basic understanding.
@jason17493
@jason17493 3 жыл бұрын
very helpful for day to day scripts, py makes it easier. Thanks Corey!
@Fire_Fly_101
@Fire_Fly_101 4 жыл бұрын
Its a really helpful video with all the necessary knowledge about the subprocess module. It was a great and very informative video. Cant thank enough for this..!
@Jonix-redhat
@Jonix-redhat 3 жыл бұрын
Brilliant as usual! thx Corey!
@WeedMIC
@WeedMIC 5 жыл бұрын
This is exactly what I was working on - ty evet sm!
@polliluiz
@polliluiz 2 жыл бұрын
Amazing explanation Corey. God bless you man!
@lingxu5598
@lingxu5598 Жыл бұрын
Another amazing video from my best CS teacher Corey...
@quantum-t
@quantum-t 4 жыл бұрын
A perfect way to create a server shell that is able to accept villain commands via Get params :) Thx a lot for the video.
@fmcmendonca
@fmcmendonca 4 жыл бұрын
Oh man thank you for this video!! Saved my day!!
@Vpy2023
@Vpy2023 4 жыл бұрын
Thanks a ton man!! Your videos are very useful!
@eliisrael1545
@eliisrael1545 3 жыл бұрын
So clear and so effective , great thanks
@VectorLP
@VectorLP 2 жыл бұрын
thanks so much for this tutorial, i was ripping my hair out trying to figure out how subprocess works and you explained it in a extremely clean way
@user-pt4vn5hr2z
@user-pt4vn5hr2z 4 жыл бұрын
Again, thank you Corey!
@purplev2791
@purplev2791 5 жыл бұрын
Sometimes I feel like Brad Traversy and Corey Schafer are stalking me...but thank you very much for bringing the exact content I'm looking for! =)
@jonathanhenyolson
@jonathanhenyolson 5 жыл бұрын
The only two I'm subscribed to! They're the best
@lucascott5631
@lucascott5631 5 жыл бұрын
I love the python tutorials!
@suhaibalrabee9399
@suhaibalrabee9399 23 күн бұрын
I couldn't find such explanation for this topic in my overpriced premium subscriptions (CBT, PS, Orielly). This should not be free, please keep up the great work, thanks!
@coreyms
@coreyms 22 күн бұрын
Thanks so much!
@antoniomontana351
@antoniomontana351 4 жыл бұрын
your voice is encouraging me to watch your videos.
@coreycarter5668
@coreycarter5668 5 жыл бұрын
Ooohhhhh mmmyyyy gooossshhh! I was just working with this last week!
@dennispeacock6079
@dennispeacock6079 4 жыл бұрын
Really, Really liked this lesson!!! Thank You!!!!
@EdwardSileo
@EdwardSileo 4 жыл бұрын
Holy cow! Great tutorial.
@PizzaLovingNerd
@PizzaLovingNerd 2 жыл бұрын
Very good tutorial. Thank you a ton
@AnasAlsayedStudio
@AnasAlsayedStudio 5 жыл бұрын
just wanna say that you're the best in delivering tutorial I've ever seen in youtube :D I hope if you make a tutorial about Vue js + Django will be really nice and original tutorial
@sharifahmed1925
@sharifahmed1925 5 жыл бұрын
Django integrated with Vue.js please!!!!!
@AnasAlsayedStudio
@AnasAlsayedStudio 5 жыл бұрын
@@sharifahmed1925 :D oh أهلًا وسهلًا
@fcmorena246
@fcmorena246 3 жыл бұрын
Great Content, really helpful. Thanks
@nelsondamianbrizuela7472
@nelsondamianbrizuela7472 3 жыл бұрын
great video, very well explained, thank you a lot!
@TheSuperFather
@TheSuperFather 4 жыл бұрын
Perfect! Thank you!
@OliverHext
@OliverHext 3 жыл бұрын
Great video. Well explained.
@fahdalawsi2172
@fahdalawsi2172 10 ай бұрын
Amazing explanation thank you!
@srinidhiii
@srinidhiii 4 жыл бұрын
amazing tutorial. thanks a lot for sharing your knowledge
@tyaprak
@tyaprak 4 жыл бұрын
Great content as always.
@flatearth1023
@flatearth1023 3 жыл бұрын
Excellent content man, i appreciate
@medi7573
@medi7573 5 жыл бұрын
AMAZING, like always.
@juliocardenas-rodriguez1986
@juliocardenas-rodriguez1986 2 жыл бұрын
yet again; your video is very informative and practical =) Thank you
@user-jq3um6ez2h
@user-jq3um6ez2h 3 жыл бұрын
Thank you very much. This video solved a lot of my problems
@fricon484
@fricon484 3 жыл бұрын
Thank you guy you are the best!
@wisamkhalid5663
@wisamkhalid5663 4 жыл бұрын
Great expanation..easy and direct..thanks
@jaehochoi8062
@jaehochoi8062 Жыл бұрын
Very very very useful. Thanks.
@HK-sw3vi
@HK-sw3vi 3 жыл бұрын
absolutely wonderful
@prashantsrivastava6123
@prashantsrivastava6123 3 жыл бұрын
Awesome content... thank you very much
@alanluna1796
@alanluna1796 Жыл бұрын
Very well explained, thanks for share
@user-be6xe4gq1l
@user-be6xe4gq1l Жыл бұрын
very informative much appreciated
@ori61511
@ori61511 4 жыл бұрын
I would LOVE to see you solving project Euler problems live on youtube! would be so interesting.
@devravan9839
@devravan9839 Жыл бұрын
Very useful video sir. Thank you♥
@andreamagista6742
@andreamagista6742 5 жыл бұрын
I never commented on a KZfaq video but this time I want to make an exception. Your tutorials helped me a lot to learn the fundamentals of Python and thanks to you I am able to write scripts that help me a lot in my job as an IT professional. Thank you Corey for the fantastic job you are doing. Can I suggest doing a tutorial on the shutil module?
@736939
@736939 5 жыл бұрын
Corey, please continue :) Microservices and Network Programming
@dennisasamoah2213
@dennisasamoah2213 4 жыл бұрын
Great as usual
@sagar1553
@sagar1553 4 жыл бұрын
That was really useful.
@krishnajunk
@krishnajunk 4 жыл бұрын
Very good tutorial. Thanks
@emmanuelyaro8322
@emmanuelyaro8322 2 жыл бұрын
Thank you for your content
@MrStix21
@MrStix21 3 жыл бұрын
Doing the lords work bud... keep it up. Did you ever get around to doing the bytes vs strings vs unicode, encode and decode video mentioned in this?
@HermannWinter
@HermannWinter 11 ай бұрын
still the best python tutorials 👍
@aashayamballi
@aashayamballi 5 жыл бұрын
Thanks Corey 😄😄
@germanquiroz2498
@germanquiroz2498 3 жыл бұрын
Hola Corey, gracias a tu informacion pude resolver un problema con un cuaderno de Jupyter. Best regards!
@santhoshkonduru4083
@santhoshkonduru4083 4 жыл бұрын
Hey Corey... Thanks a lot for providing such a great stuff on python. I learned a lot from your videos. Can you please please do a series of videos on multithreading/multiprocessing in python as I am very much confused with these topics especially while implementing them in python.... I hope you will consider my request... Thanks
@austecon6818
@austecon6818 4 жыл бұрын
great video. Cheers
@mohitarora1701
@mohitarora1701 3 жыл бұрын
Thanks for this video I got solution for my automation script 😊 I tried things from last 5 days and now I got that
@kalpanarendarreddy5417
@kalpanarendarreddy5417 Жыл бұрын
My best teacher of python forever.......................love u corey ❤ 💕 always
@henrypierre5285
@henrypierre5285 3 жыл бұрын
thank you so much :)
@huydong8774
@huydong8774 4 жыл бұрын
I really appreciate and love your tutorials. Could you please make a book version on all of that contents that you produced? So that I can easily to reference for convenience. I will be the one who buy your book first.
@rahulkhod1505
@rahulkhod1505 3 жыл бұрын
Explain very well sir..
OMG😳 #tiktok #shorts #potapova_blog
00:58
Potapova_blog
Рет қаралды 4,1 МЛН
MEU IRMÃO FICOU FAMOSO
00:52
Matheus Kriwat
Рет қаралды 39 МЛН
WHO DO I LOVE MOST?
00:22
dednahype
Рет қаралды 78 МЛН
25 nooby Python habits you need to ditch
9:12
mCoding
Рет қаралды 1,7 МЛН
Understanding stdin, stdout, stderr in Python
11:53
NeuralNine
Рет қаралды 11 М.
Modern Python logging
21:32
mCoding
Рет қаралды 157 М.
Python Call a System Command!
10:14
DevOps Journey
Рет қаралды 24 М.
5 Good Python Habits
17:35
Indently
Рет қаралды 403 М.
Python Tutorial: if __name__ == '__main__'
8:43
Corey Schafer
Рет қаралды 2 МЛН
Is THIS Python's MOST Underrated Operator? (Walrus Operator)
5:45
Practical introduction to Python's subprocess module
52:46
Samuel Chan
Рет қаралды 4,6 М.
Argparse Tutorial - Python  2023 (Creating Your First CLI)
18:59