 Hey, what's up guys root of the know here and today we're looking at even more Python man. We are on a roll with this language Aren't we? So today I want to let you guys know how you can set up your scripts to be able to run them We're gonna get to this part of the tutorial series. We're actually gonna start to write software rather than just playing inside the interactive shell So we're gonna need to create a new window. We're gonna need to save the file as something we can run and Yeah, let's get started with idle I'm gonna open it up in Linux first of all and then I'm gonna show you how to get this stuff done on Windows in case you Don't know because it's a little bit of a different structure, but let's get started with a new window I'll bring that up here. I think we'll just We'll make an incredibly simple program that all it says is Hello world actually, let's make a little bit fancier. Let's Let's give a variable. Let's give it. Let's give it a caption Here it is. Let's type in a hello world I'm not a semicolon here And I'll talk to you guys about semicolons a bit more in another video, but here we're gonna type in print caption Then we're gonna save this. I'm gonna bring over the dialog box You can see what I'm doing here and we're gonna call this file Dot pie file dot Python. Oh Let's put a semicolon here just to be proper to and let's get open up a terminal Now this is where you're gonna want to be now you can do some different things with this before we get started with the terminal Let me show you how you can do things in in an idol If you want to you can just hit run up in the menu bar and hit run module and then your program will run perfectly fine You can just hit you can just hit the f5 here to do that again as many times as you need to remember that this The file has to be saved. That's because Python is a scripting language and that's another thing that I'll get into more But the file does have to be saved before you can run it So if you if it isn't saved It'll ask you source must be saved before we start doing things that okay, and then yeah, yeah, that's fine I don't care that run the program and you're done now when you're at the terminal or the command line you can Okay, let me make sure we've got filed up Python. Here we go good if we do Python File dot pi if we pass in that file to the Python program Without invoking the interactive shell. We should be perfectly fine It'll run the program Exactly how we want it to we don't have to type in the full name because at the command line You can just hit tab and it'll fill things in for you. So Python file. I wonder if it'll know it does need that whole file name It needs the extension But it'll run the thing as many as whatever we need to if we don't want to be passing it to Python all the time We just want to set this as an executable file. We need to include what Linux calls a shebang line and Let's make this visible to you here This the shebang line let's the let's the system know or let's Linux know that this is the program that we want to be Whatever But yeah, this lets the program know this lets Linux know that this Path right here is the pro is the path of the program that you want to understand this file So if we go back to our Python file here, we type that in the shebang line us are bin Environment Python, so this will link us to the Python environment It'll link us to the it'll point the system to the Python interpreters kind of a kind of what I'm trying to say here You don't need to send me calling here because this is just a normal instruction So if we save that we can run it an idle. We don't have to do that though And we'll bring it back to the command line. So now we're at the command line I'm gonna hit control L to clear the screen and We have file dot Python, but it's not executable yet So what we're gonna want to do is type in shimod or chm od At an x so we can add to it and then we're gonna want to type in the file name. Let's call it file dot Python Grand now you can see that it has a little bit of a different color scheme if we list out the files And we'll type in file dot Python. It'll run and it runs perfectly fine. Just like that There you go It's exactly what we wanted it to do and we can do that either invoking Python or Now we can run it without that and it just makes things a lot easier. So kudos to that now That's how you can do it in Linux They are in in Windows. It's a different sort of style So I'm gonna get Windows 7 started up here and let you guys show you I'm gonna show you guys how to get it done Windows is gonna be pretty clunky as always and virtual box is just gonna splatter all over my screen because that's what it does and I'll jiggle this window for a little bit while we wait I'm gonna log in and Boom, let's get started. You can hit the Windows key and Get idle started up and we'll practically do the same thing that we just did in Linux. We'll create a new file and We'll just do caption equals Hello And that's all we really want Print, let's make sure we type that function correctly print caption Let a little semicolon here and let's get started to save this Well, I'm gonna put it in my desktop just so it's visible and you guys can see it and we'll name this one file dot Python Now that that's saved we can if we go back to our desktop We can see it right here What we could do is we could click on it and then it'll open up the command prompt incredibly quickly though Because it's going to run to the it's gonna run to the end of the script It's gonna run through the program and then when it's done it just shuts down it goes away So if you don't have any prompts for the user, it'll just start and then vanish It'll breeze through the program without letting you even see what's going on So to avoid this without having to create a prompt for ourselves. We can go into cmd We can either start it up in the start menu We can hit Windows key and R to bring up the run dialog box That should work on yours since I'm in a virtual box that might not but once you get cmd open just type in cmd That's the command you're going to use and navigate with the cd command to wherever you save it I'm in the desktop. So I'm going to cd to the desktop If we look here, we have file dot Python. That's awesome. That's exactly what we want to be looking at So we're just going to type that in file dot Python We hit enter and we get hello. We get exactly what we wanted when we save that file So boom, that's how you do it That is how you save and you run your font and your your Python scripts and Linux That's how you do it in in Windows at the moment because we're going to be using some command line programs first I don't know if we ever will venture into the wonderful world of the graphical user interface But for now, this is how you should be running your programs in case you don't want to do it in idle So there's that's how you go. That's how you do it So thank you guys for watching. I hope this is a little bit helpful I know it was a bit more of a bit of a breeze tutorial since we're just sort of running through how to get this done But this should come in handy for the next couple of tutorials because we are going to move ourselves into a world Where we have a blank canvas. We don't have this little prompt where we are all we have to do is type in commands We will be able to write our own code from scratch So I hope you're excited. I hope you're as excited as I am and I will see you in the next tutorial