Python using Raspberry PI

i’ve been using the Python that came installed on my Raspberry PI working thru exercises in “Learn Python 3 the Hard Way”. i’m at exercise 13, and the linux terminal is not recognizing the the command to run the script.
the prompt is pi@raspberrypi:~$ i . i type python ex13.py first 2nd 3rd and get error msgs that python can’t open file or no such file or directory exists. i have read thru the python documentation and tried all forms of inputting the command but keep getting the same error msg.
i know this is two problems and don’t expect any help with the raspberry pi. but is this a python problem or a linux problem?
any suggestions on what to do next or where to go next?

Do you know what python version you are using and which OS? Is it Raspian and python 2.x?

You can check with

python —version

Two things:

  1. Is the ex13.py file there? Do:

ls ex13.py

  1. If it’s not there, then you need to find it. Where is it being saved in your editor?

Related to that, what editor are you using? I’m curious about the RPi setup.

  1. version number: the response on the terminal screen is as follows:
    python 2.7.13 (default, Nov 24 2017, 17:33:09)
    [GCC 6.3.0 20170516] on linux2
    type “help”, “copyright”, “credits”, or “license” for more information
  2. the OS is Raspbian
  3. i have tried including a path to the document ex13.py, that path is
    /home/pi/documents
    and,
    i have tried it without the path
  4. within the python 2.7.13 shell, “python -version” does nothing except respond with
    Traceback (most recent call last):
    File “<pyshell #0>”, line 1, in python -version
    NameError: name ‘python’ is not defined
  5. within the rasperberry accessories terminal:
    prompt is pi@raspberrypi:~S
    at this prompt, i entered “python -version”
    and got the response: Unknown option: -e
    usage: python [option] … [-c cmd | -m mod | file | -| [arg]…
    Try ‘python -h’ for more information

from linux user interface screen, i select the raspberry which opens a list of applications. from this list, i select Python 3(IDLE)
when the IDLE opens, i select the help / about. it says Python version 3.5.3
back to the IDLE menu, i have the option under File to select either Open or Open Module. if i select Open, the default directory is /home/pi/documents. this is where i saved my example scripts, i.e., ex13.py. i select ex13.py and it loads. from the IDLE menu i then select Run / Run Module and get a window titled “Python 3.5.3 Shell”
inside the window, the following is displayed:
Python 3.5.3 (default, Jan 19 2017, 14:11:04)
[GCC 6.3.0 20170124] on linux

============== RESTART: /home/pi/Documents/ex13.py ================
Traceback (most recent call last):
File “/home/pi/Documents/ex13.py” line 3, in
script, first, second, third=argv
ValueError: not enough values to unpack(expected4, got 1)

note: the script was entered exactly as in the example from the book. no commas separate the arguments.

Yeah well, it seems you’re running the script without any arguments.

There should be a way to launch the script with arguments in the IDE, but that’s not a solution to your main problem.

Could you post the exact error message that you get when you do this?

At this point you typed:

python -version

When it’s:

python --version

Next, when you run the script, you have to type this:

python ex13.py first second third

This error is actually listed in the exercise and has giant red text. Please go read it again completely and make sure you see where I mention this. If I don’t mention it boldly enough for you please tell me why you missed this error, my output, and my demo of how I run it.