optparse TypeError

dirknbr dirknbr at gmail.com
Mon Jun 28 09:30:46 EDT 2010


I get an int object is not callable TypeError when I execute this. But
I don't understand why.

    parser = optparse.OptionParser("usage: %lines [options] arg1")
    parser.add_option("-l", "--lines", dest="lines",
                      default=10, type="int",
                      help="number of lines")
    parser.add_option("-t", "--topbottom", dest="topbottom",
                      default="T", type="str",
                      help="T(op) or B(ottom)")

    (options, args) = parser.parse_args()
    if len(args) != 1:
        parser.error("incorrect number of arguments")
    lines=options.lines
    tb=options.topbottom

Dirk
    lines(args[0],topbottom=tb,maxi=lines)



More information about the Python-list mailing list