Learn python three the hard way

Ii need help with exercise 13. I am using python 3.8.2 and everytime I try running the code:
from sys import argv
script, first, second, third = argv
print("The script is called: " , script)
print(“Your second variable is:”, second)
Print(“Your third variable is:”, third)

Everytime I run the the code with the instructions from the book (learn python 3 the hard way) I get an error ! I’ve tried all possible ways to no avail. Someone please help.


Try running

python exr13.py first second third

It’s shouting at you because it doesn’t like the program type with the dot notation I believe.

You can check your default or environment python version with

python —version

If it show python 3.x then you’ll be okay to just run python command without a number suffix.

If it shows python 2.x.x the run with python3 and no suffix.


I have been running the other codes with no problem, and yes I’m using python 3.8

This is a totally weird one. Those are powershell errors. As @gpkesley said it’s complaining that it doesn’t know the executable python3.8, but it looks as if your script was run successfully before it complains because the output is there.

Have you changed anything in your setup since when it last worked? Any forced Windows updates? Can you find where your python3.8 exe is installed and then check if the directory is in your PATH?

It has to be said, the two biggest occurrences of issues on this forum are rooted to Powershell or Nosetest.

I can’t work out why it executes the script before complaining…

Thanks I figured a way to run the code. Thanks a lot for your help

Good. Did you find out what was causing this?

Hi, can you explain how you’re running the code just so we can be sure you’re not doing it in a way that gets in the way later?

Also, on Windows you can do a screenshot with the Snipping tool. Hit the windows key and type “snip” or type “screenshot” and it will come up. That’s if you want to do an image, but the better way to do it is to copy/paste the text:

  1. Select all of the text in the powershell window with your mouse.
  2. Hit enter and that copies.
  3. Come here and type this:
<ctrl-v here to paste>
  1. Those characters are “backticks”, not single-quotes. Mine is under the ~ character. Once you do this you’ll paste plain text and then we can see it very clearly and it’s faster and easier to do. You can also do this with code you wan to show.
A free service run by Zed A. Shaw for learncodethehardway.org.