I am puzzled as to why this program is throwing an
AttributeError: 'module' object has no attribute 'error'
This example is right out of
http://www.artima.com/weblogs/viewpost.jsp?thread=4829
I would appreciate any thoughts as to what the problem might be.
tnx
cmn
#!/usr/bin/python
"""Module docstring.
This serves as a long usage message.
"""
import sys
import getopt
def main():
# parse command line options
try:
opts, args = getopt.getopt(sys.argv[1:], "h", ["help"])
except getopt.error, msg:
print msg
print "for help use --help"
sys.exit(2)
# process options
for o, a in opts:
if o in ("-h", "--help"):
print __doc__
sys.exit(0)
# process arguments
if __name__ == "__main__":
main()