AttributeError: 'getopt' module has no attribute 'GetoptError'

Gustaf Liljegren gustafl at algonet.se
Tue Jul 3 17:15:55 EDT 2001


I use Python 2.1 on Win98.

Try to use the getopt module, but get the error in the subject line. What's 
wrong? My code:

try:
  opts, args = getopt.getopt(sys.argv[1:], 'f:hcr')
except getopt.GetoptError:
  usage()
  sys.exit(2)

Another question about getopt: Are options optional by nature? You can't 
have a mandatory option?

Regards,

Gustaf Liljegren



More information about the Python-list mailing list