fartynugget007 fartynugget007 - 4 months ago 21
Python Question

Why is my Python script not running via command line?


def hello(a,b):
print "hello and that's your sum:"
print sum
import sys

if __name__ == "__main__":

It does not work for me, I appreciate the help!!!


To execute your program from the command line, you have to call the python interpreter, like this: C:\Python27>python hello.py 1 1

If you code resides in another directory, you will have to set the python binary path in your PATH environment variable, to be able to run it, too. You can find detailed instructions at Adding Python Path on Windows 7