James
James

Reputation: 11

Running a python script from a command line in Windows

I'm currently following the book, "Learning Python The Hard Way" and I am stuck trying to make a script run from the command line.

I have saved this text:

from sys import argv

script, first, second, third = argv

print "The script is called:", script
print "Your first variable is:", first
print "Your second variable is:", second
print "Your third variable is:", third 

as ex13.py in my Python folder. When I try to run it from cmd, it comes up with this error:

"File "<stdin>", line 1
python ex13.py first 2nd 3rd
          ^

Can you explain what this means and how I can fix it? Sorry for being a noob :)

Upvotes: 1

Views: 1113

Answers (1)

andrewdski
andrewdski

Reputation: 5505

It looks like you are typing the line

python ex13.py first 2nd 3rd

into the python interpreter. You are supposed to type that at the cmd prompt.

Upvotes: 7

Related Questions