Well, in my famous do over I’ve made it to Ex16. My question doesn’t have anything to do with that though. Just what is the difference between WinPS and the terminal that comes with Python? I know that is sort of a trick question because they both do, but on my desktop I have the icon for Python and also for Win PS. Zed told my to not use the icon for Python but to go through the Start menu. I do that most of the time for Win PS too. Does Win PS have easier error warnings? Is it sort of just for novices starting out? Just curious. Thank you. Not2smart.
Nice to see you keep strugling with the book.
There are some ways to get a python promt.
You probably have Python IDLE because you have Windows.
Start it and you see a new window with three ”>>>” to the left.
This is a Python prompt.
Or you can start up a prompt with Powershell.
Just type ”Python” and powershell will change to a python prompt.
You will see the three ”>>>” in there too.
To stop the prompt you can type ”quit()”
I guess the Traceback ( error warning) should be the same.
Welcome back Ric. Are you watching the videos this time? I start up windows powershell all the time in the videos so you can watch one of those to see what I do. In general though:
- You should not ever be running python from the start menu or by clicking on it. You should only ever run python by typing the word “python” while inside PowerShell.
- PowerShell is very capable and you just run it from the start menu. Just be sure to not use powershell ise.
Drop a couple screenshots here to show us what you’re talking about.
My question wasn’t really answered and I think I didn’t make it clear what I wanted to know. I wasn’t asking how to start winPS or anything like that, all I wanted to know is what is the advantage of using WinPS verses the Python terminal (whether you start it from the ‘Start’ menu or icon). About the only difference I see with PS is that it gives you part of the path, whereas terminal just gives you >>>. I don’t use Idle. Thank you. Ric.
Ok, the problem is there’s no such thing as “the python terminal”. You’re going to have to post a screenshot for me to see what this is before I can answer.
You can do a screenshot on Windows 10 using the Snipping Tool:
Once I know what “python terminal” is I can tell you. But, I can also tell you that if you’ve found some other terminal then it’s probably not one you should use. But, let me see this other one.
Zed: This is a picture of my desktop. (Yes, I took the picture.) As you can see, I put arrows by Win PS and the Python icon. This is the same icon in the list of programs when I open the Start icon at the bottom. It was in the Python file that I downloaded and just went to python.exe and brought up the ‘put icon on the desktop command’ and wa la. RicUploading: My desktop2.jpg…
On picture below you have another python prompt. Its the same as when you start up powershell and type the command ”python”
(without the parentheses).
So its just another way to interact with Python.
I use them just to learn more about a function before start using it.
Short snippets of code. If I like it I write the same snippet into my file and get it working with the previous code.
Nothing is saved when you close the prompt.
What @ulfen69 says is right. But, let me break it down a bit more.
When you start PowerShell and type this:
You are running a program called
python.exe that lives “somewhere” on your computer. You could find it but it’s usually different depending on the kind of computer. When you run this, it starts up the python interpreter (aka the language), and then gives you a way to interactively code some python. We call this a “prompt”, “a shell”, “a terminal”, etc. and it’s just a way to do quick scratch tests of code and calculations.
When you double click this icon, you’re doing the same thing as opening powershell and typing “python”. When you hit Start and type “python”, you’re doing the same thing as opening powershell and typing python. They all run the same program, and this lets you interact with python.
But, inside this python shell you can’t run any powershell commands like cd, ls, pwd, cp, and so on. The reason why is when you double click the icon, or run python from the start menu, your python.exe is just running by itself, and can’t use any powershell features.
If you start Python from inside powershell it gets setup like this:
+----------------------------------------------+ | PowerShell | | +------------------------+ | | | python.exe | | | +------------------------+ | +----------------------------------------------+
In this scenario, you started powershell, and windows is running it, and then PowerShell started python.exe and PowerShell is running it. That lets you exit out of the Python shell and run scripts and commands. Without this ability to use powershell again, you wouldn’t be able to do:
Because python.exe doesn’t know anything powershell does, and while you’re inside that inner box labeled “python.exe” you can’t do powershell commands. You have to exit out of the box (with quit()) and then you can run
python ex14.py since that is actually a powershell command.
Does that clear things up?
Yes. That also explains what you said when I did Python the wrong way at lesson 25 I think it was. You said that I did it wrong and couldn’t do it that way and to start over. I’m glad I got that straightend out because I was concerned that when I get to lesson 25 (or whatever it was), I would have the same problem. Ok, thank you. Not2smart.
I just love this kind of self distance/humor.
Just keep working.
If not already, sooner or later the ”aha” experiencies start to pop up.
Ulfen69: I sure hope so because I need about two dozen more ‘aha moments’.