What does the sys module do in python?
and what is sys.argv?

That's exactly where I checked. I don't understand what the documentation says..
More specifically I don't understand this

The list of command line arguments passed to a Python script. argv[0] is the script name (it is operating system dependent whether this is a full pathname or not). If the command was executed using the -c command line option to the interpreter, argv[0] is set to the string '-c'. If no script name was passed to the Python interpreter, argv[0] is the empty string."

Maybe a little example will help ...

import sys

args = sys.argv

print( "Source  file: %s" % args[0] )
# use any of these arguments in your code
print( "Argument one: %s" % args[1] )
print( "Argument two: %s" % args[2] )

my output after saving this code as sysargs1.py and 
entering a few arguments on the command line -->
['D:/Python25/Bull/sysargs1.py', 'myarg1', 'myarg2']
Source  file: D:/Python25/Bull/sysargs1.py
Argument one: myarg1
Argument two: myarg2
A short ,clear post. .I deal for forums

So for the last two to have values, is it compulsory for the program to be run via command line?

You can run it with module subprocess as well

import subprocess
child = subprocess.Popen("sysargs1.py myarg1 myrag2", shell=True)
This question has already been answered. Start a new discussion instead.