On 9/22/08, Tasos Latsas <[EMAIL PROTECTED]> wrote: > Hello list, > I tried the optparse example from the python library reference and it > doesn't seem to work..what am I doing wrong? > I keep getting the "incorrect number of arguments" message although i > use the correct number..
Actually, you aren't using the correct number of arguments for the code as written. This line: if len(args) != 1: parser.error("incorrect number of arguments") checks to see if the arguments, not to be confused with the options, are greater than one. So, one way you might call the script would be: python parser.py somefile.txt Take care, Don _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor