fartynugget007 fartynugget007 - 1 year ago 89
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!!!

Answer Source

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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download