title: Program invoking: at least one command line parameter
body: <p>I'm trying to check that a user of this code runs this program from command line using only one command line parameter (the name of the file). When I run this code like this (I'm on windows)</p>
  
  <pre><code>C:\&gt;python program.py
  Usage: program.py &lt;file.txt&gt;
  C:\&gt;
  </code></pre>
  
  <p>Right. But when I run this program using a file I want to manipulate, I get nothing printed:</p>
  
  <pre><code>C:\&gt;python program.py file.txt
  
  C:\&gt;
  </code></pre>
  
  <p>Where's the problem, my code is here</p>
  
  <pre><code>#!/Python26/
  # -*- coding: utf-8 -*-
  
  import sys
  
  def main(argv):
      if len(argv) &lt; 2:
          sys.stderr.write("Usage: %s &lt;file.txt&gt;" % (argv[0],))
          return 1
  
  if __name__ == "__main__":
      sys.exit(main(sys.argv))
  
  f = open(sys.argv[1])
  lines = f.readlines()
  f.close()
  
  for line in lines:
      line = line.strip()
      etc...
  </code></pre>