I'm stuck using python 2.4 for this project so I'm using optparse. Getting the following error when running this code:
Traceback (most recent call last):
File "./clientNFSLatMonME.py", line 49, in ?
debug,verbose,interval = parseOptions()
File "./clientNFSLatMonME.py", line 43, in parseOptions
if (args.interval < 1) or (args.interval > MAX_INTERVAL):
AttributeError: 'tuple' object has no attribute 'interval'
Code is as follows:
MAX_INTERVAL = 1800
def parseOptions():
parser = OptionParser()
parser.add_option("-d", "--debug", dest="debug", action="store_true", help="enable additional debugging output")
parser.add_option("-v", "--verbose", dest="verbose", action="store_true", help="enable additional console output")
parser.add_option("-i", "--interval", dest="interval", action="store", type="int", default=900, help="specify the time interval, default is 900, maximum is 1800")
args = parser.parse_args()
if (args.interval < 1) or (args.interval > MAX_INTERVAL):
print "Error: interval must be between 1 and " + str(MAX_INTERVAL) + ", terminating."
system.exit(1)
return args.debug, args.verbose, args.interval
debug,verbose,interval = parseOptions()