Hi, I find in all books and websites that in order to run a Python script from the command prompt, I have to run something like this

python example.py 1.3

where example.py script is provided with an argument of 1.3. However, it is not working for me in Windows 7 until I delete the python part, so that the command looks like:

example.py 1.3

I have already changed the path variable of Windows to include the Python directory. Why isn't the python word necessary for me, even though it's mentioned everywhere? And why does it throw an error when I use the python word See the image to understand my problem.

Authors do not make this clear but there are two shell prompts involved- the Windows prompt and the Python prompt.

If you start with the Windows command shell prompt, then typing "python" will find the path to the python program and start it.
Once it has started, then you are in the python program's shell prompt and typing "python" has no meaning to it. It is expecting python commands, not Windows commands.

python needs full path of argument or you must start it in the location of the file. Windows searches commands anywhere in the path when file is first in line.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.