Hi Ric
I still want to know if you have installed Powershell.
Hi Ric
I still want to know if you have installed Powershell.
Ulfen69: As I said in the first sentence of this postâŚ
Let me go over what I have done so far with ex25.py in the LP3THW book. I copied all the code on page 90 in Notebook ++. I opened it in Win Powershell.
So yes, I have only used WinPS and Notepad++.
I donât mean to be nasty, but some of my questions donât seem to be answered. All I want to know is what Iâm supposed to put after the prompt, and why it is not loading my code? Thank you. Not2smart.
Ok.
Sorry. I did not anything before this answer that you are using Powershell.
So.
Do you know how to see where the powershell is located when you start it up?
Do you know how to navigate to the directory where your ex25.py is?
Do you know how to see if your file is in the directory where you have changed to?
I hope you just answer me:
Yes. I know this now.
Or:
No. But I will start learning this from now.
These are basic knowledge you should have to be comfortable with using powershell and much more effective working with Python.
You see. I still want to help you.
If you donât want my help just tell me.
Best regards
Ulfen69
Hi @Not2smart I will try to give my 5 cents in this discussion. I think you have some confusion about how to use powershell. You donât have to open anything in Powershell. You have to be in the Powershell and then run some commands.
lpthw
is on C:\lpthw
, so I have to type:cd \lpthw\ex25\
ex25.py
is in that directory/folder. Type ls
and it should look something like this:python ex25.py
It should work.
Kind regards,
Didier
Iâm back from my trip @Not2smart so Iâll handle your email and give you access to the videos, but this is the problem:
âat this point I return to my computer and launch Python 3.7 from the icon on my desktop. It loads up and has the lines of info as is on page 91 of the book, with the >>> prompt.â
I do NOT ever click on any icon to run python. Ever. Never. I never run anything in programming by clicking on anything with my mouse ever. I type the commands INTO POWERSHELL. Always.
If you are clicking on icons and clicking on files then thatâs the problem. I suspect youâve done this for all of the book up to exercise 25 and it mostly worked, but now youâre stuck. I actually wonder how you did that because I say and show how I do it over and over in the book.
So, Iâd like to also give you a call and talk to you to find out what youâre doing. Mostly to see where you got derailed on this and how to course correct. Iâll shoot you an email, but look at what @DidierCH wrote and the screenshots he posted.
Ulfen69: Sorry that I was a little testy. I appreciate your help. I think Zed found my problem, because Iâm opening PS with an icon on the Desktop. I donât know what is wrong with that,but I guess I will learn pretty fast. Thanks. Not2smart.
Perhaps I was a bit harsh myself.
But I am happy to help if you want.
Please tell us how you get along.
Ulfen
Zed: Hmmm. I have been clicking on icons to launch programs since Win 3.1. When I load a new program, I just naturally put an icon on the desktop. I didnât know it made a difference. (I still donât know why.) My ISP is having problems with email right now so even if you send something I wonât be able to open it. Iâll spend the weekend going over what you and the others have written and see what happens. Thank you.
P.S. Iâll send you the money for the videos, right now I have Christmas and property taxes due in the next month, so it might be a few weeks. If I canât afford something, I donât buy it. No freebies for me. Not2 smart.
I have been using an icon on the desktop to launch P.S. According to Zed, that is a no no. First time I ever heard that. Not2smart.
To load PowerShell, yes thatâs fine but I suspect you are loading a lot more than powershell by clicking on things.
But, I think a large part of the problem with helping you is the information you give on what your issue is ends up being very thin and vague. It looks like your writing style for the posts is without any formatting and thereâs no screenshots or copying and pasting of output. I think thatâs what Iâm sort of baffled by, and why I wonder if youâre unaware of this or simply canât do it for some less obvious reason.
So, let me take a minute to sort of lay out what you do vs. what would help people help you more. Hereâs an example of an excerpt from your post, but broken down line by line:
python ex25.py
, or did you do something else. Whereâs the screenshot for this, or the copy-paste of what is currently showing in your powershell?python
to execute the ex25.py
by typing only: python ex25.py
. So, a detailed step by step explanation of what youâre doing to âopen in python 3.6â would help us figure out whatâs going on.Now, how you can improve your help requests (and also help yourself figure out whatâs wrong) is to become systematic about explaining whatâs wrong. Thinking systematically is what you have to do when you code. You tend to write huge giant stream of consciousness paragraphs with no line breaks and very little punctuation. To code you have to break this habit and start thinking in terms of step-by-step operations of a system. One way to help you think about this is to imagine this:
âHow would I explain whatâs wrong to a 5 year old?â
To explain to a 5 year old youâd have to do it slowly and in small incremental steps until they get it. So with that in mind, you can do this to improve how you communicate your problems:
[code]
, then paste your errors, code, anything you want to show, then type [/code]
to close your code block.Changing up how you post your code for help would vastly speed up and improve your response. If you have an explanation about why you arenât posting your code and errors then let us hear it. Otherwise, letâs see that stuff. Itâs easier to help you then.
Hi all, is there a reason why you all start off using a CMD line/terminal/shell versus editing code/a script file in Notepad++ a more robust text editor like Atom or Sublime? I find that their thematic syntax highlighting and built-in linting reduces errors due to whitespace or typos.
Indeed, we all use a robust text editor like VSCode, Atom or, like some of us, Vim. But to run the code I do it always from the terminal/shell (thought you can do it in some sophisticated text editors directly, aka VSCode, Atom).
For a beginner in coding it might be best to start with the simplest solution like gedit or notepad++ so you donât get distracted by all the cool features of the other editors and still have syntax highlighting and the like.
p.s.: I think zedâs last suggestion was to try VSCode.
For a beginner in coding it might be best to start with the simplest solution like gedit or notepad++ so you donât get distracted by all the cool features of the other editors and still have syntax highlighting and the like.
I didnât realize that there were so many similar capabilities between all the various tools. Thank you for clarifying, I was responding to the topic under numerous assumptions about the differences between editors.
p.s.: I think zedâs last suggestion was to try VSCode.
I missed it; I was reading too fast. Thank you!
To all that helped me: Iâm going to not use this topic any more and will start the book over and do it the way the book says. Many times I would not send copies of my work because I would spend time trying to work things out, then disgusted and tired, just shut down the computer. I did not know that you canât use icons to start a program for some programs. That might be my problem. I will also watch the videos and look over the .pdf files. Thanks for all your help. (To those that donât like my handle, Iâll use my name. Ric Trexell, hopefully that was⌠Not2smart.
Thatâs amazing! Keep on it and you will finally get it. I had a hard start in programming too. Itâs so different to my normal way of thinking. But as soon as you grasp it, a lot will be easier. Last year I enrolled in the free Stanford Computer Science 101 class. Something I can recommend to you, too. Nick Parlante does a good job in introducing some concepts of computer science. Itâs a good complimentary to LPTHW.
I had the same problem with ex25. I went through the comments and came across this one, and all is fixed. It turns out I had saved the ex25.py file in a different folder via Atom. So I copied it in a correct folder and it worked out just fine.
OK, I had problems back in Nov. when I first started with ex25.py and went back and did the book from the beginning at lesson one. Now Iâm back to lesson ex25.py and having some of the same problems. Basically, I do this. I go to the Start ball and click it to bring up Win Power Shell. In PS I notice something different from the videoâs of Zedâs. This is what I get after the C stuff,Users\Ric and I type Python but Zed puts in lpthw> python. I get problems if I add âlpthwâ. I wanted to paste that in here but that doesnât work. I get the lines that say all that about help, copy write and then the >>>. I then type import ex25, and get error messages. I did go back today and check my ex25.py file for errors even after I had ran it in PS and found I really goofed up on line 28 and 29, but that is fixed and didnât solve the problem. Is there a way to paste the error message in this message box? What Iâm getting is a message that says there is no ex25. Iâm using Win 7 if that matters. If I have to type out the error messages I will, but first I would like to know, why does putting lpthw in the command line mess me up, and just putting âpythonâ makes it work up to the >>> prompt. Iâm beginning to wonder if there is something wrong with my computer! Thanks in advance. N2S.
Because the info before the prompt is generally the present working directory and the User.
If you havenât created a folder calls âlpthwâ you wonât see it, like in Zedâs example.
Letâs say you are at Windows âMy Documentsâ when you open PS. If it helps syncing to the book, create a file call âlpthwâ and change into that directory:
Rics Prompt > mkdir lpthw
Rics Prompt > cd lpthw
Now your Powershell is working in that location so you must have ex25.py in there before opening python prompt.
Assuming youâve copied it there or creates it from scratch, when you type âpython3â you will open the python prompt (with all the copyright info etc).
Now you can call the info from the ex25.py file (as itâs in that location) from the prompt (as itâs a python file, you only need the name, not the â.pyâ extension.
import ex25
As for posting errors, take a screen shot and add it by clicking and dragging it into this reply window. That should work.
Oh, I think I have the lpthw folder in the wrong place. I will look that over tomorrow. Up to this point, I have been just going to the folder and opening the files. Now I have to import them. I hope I got that right and make sense. Also, thanks for explaining how to take a screen shot to drag them into the message box. Iâll try that tomorrow. N2S.
Hey all: I got it working. I donât know what I did today that I didnât do last night, but was able to do the exercize three times due to spelling words like âwordâ, with a âkâ so that it was âworkâ. I had to fix it and start all over like the book said. Iâll try the Study Drills tomorrow. Thanks for the help. N2S.