title: Can't pass values via command line
body: <p>I have to write a program that reads from a file and writes some analysis to a text file. The program has to take some information via the command line but I can't see, to figure it out even given the template. I wrote a test program to see if I could succesfully pass command line input to the class.</p>
  
  <pre><code>#!/usr/bin/env python3
  
  ########################################################################
  # CommandLine
  ########################################################################
  class CommandLine() :
      '''
      Handle the command line, usage and help requests.
  
      CommandLine uses argparse, now standard in 2.7 and beyond. 
      it implements a standard command line argument parser with various argument options,
      a standard usage and help, and an error termination mechanism do-usage_and_die.
  
      attributes:
      all arguments received from the commandline using .add_argument will be
      avalable within the .args attribute of object instantiated from CommandLine.
      For example, if myCommandLine is an object of the class, and requiredbool was
      set as an option using add_argument, then myCommandLine.args.requiredbool will
      name that option.
  
      '''
  
      def __init__(self, inOpts=None) :
          '''
          CommandLine constructor.
          Implements a parser to interpret the command line argv string using argparse.
          '''
  
          import argparse
          self.parser = argparse.ArgumentParser(description = 'Program prolog - a brief description of what this thing does', 
                                               epilog = 'Program epilog - some other stuff you feel compelled to say', 
                                               add_help = True, #default is True 
                                               prefix_chars = '-', 
                                               usage = '%(prog)s [options] -option1[default] &lt;input &gt;output'
                                               )
          self.parser.add_argument('inFile', action = 'store', help='input file name')
          self.parser.add_argument('outFile', action = 'store', help='output file name') 
          self.parser.add_argument('-lG', '--longestGene', action = 'store', nargs='?', const=True, default=True, help='longest Gene in an ORF')
          self.parser.add_argument('-mG', '--minGene', type=int, choices= range(0, 2000), action = 'store', help='minimum Gene length')
          self.parser.add_argument('-s', '--start', action = 'append', nargs='?', help='start Codon') #allows multiple list options
          self.parser.add_argument('-v', '--version', action='version', version='%(prog)s 0.1')  
          if inOpts is None :
              self.args = self.parser.parse_args()
          else :
              self.args = self.parser.parse_args(inOpts)
  
  ########################################################################
  #MAIN GOES HERE
  ########################################################################
  
  
  def main(myCommandLine=None):
      '''
      Implements the Usage exception handler that can be raised from anywhere in process.  
  
      '''
  
      myCommandLine = CommandLine(myCommandLine)
  
          #myCommandLine.args.inFile #has the input file name
          #myCommandLine.args.outFile #has the output file name
          #myCommandLine.args.longestGene #is True if only the longest Gene is desired
          #myCommandLine.args.start #is a list of start codons
          #myCommandLine.args.minGene #is the minimum Gene length to include
  
      print (myCommandLine.args) # print the parsed argument string .. as there is nothing better to do
  
      if myCommandLine.args.longestGene:
          print ('longestGene is', str(myCommandLine.args.longestGene) )
      else :
          pass
      class Test:
          def __init__(self):
              print(myCommandLine.args.minGene)
  
  if __name__ == "__main__":
      main()
  
  class Test:
      def __init__(self):
          self.test()
  
      def test(self, infile = myCommandLine.args.inFile, outfile = myCommandLine.args.outFile, longest = myCommandLine.args.longestGene, start = myCommandLine.args.start, min = myCommandLine.args.minGene):
          print(infile)
          print(outfile)
          print(longest)
          print(start)
          print(min)
  
  new_obj = Test()
  </code></pre>
  
  <p>The command line input should look like: python testcommand.py -minG 100 -longestG -starts ATG tass2ORFdata-ATG-100.txt</p>
  
  <p>Supposedly the main program goes where it says "MAIN GOES HERE" but when I tried that I got an error that "myCommandline is not defined". So I moved the program to the end. But I get the error 'the '>' operator is reserved for future use"</p>
  
  <p>I'm using Powershell if that matters. How do I get this data into my class?</p>