I tried to use getopt and copied the example from:
http://www.python.org/doc/current/li...le-getopt.html
but nothing is working... getopt.GetoptError doesn't seem to exist and
when i run the program commenting this out, none of "-v", "-h" and
"-o" wants to be recognized... what's the matter?!
Dominik
import getopt, sys
def usage():
print "Use it like this: bla bla bla"
def main():
try:
opts, args = getopt.getopt(sys.argv[1:], "ho:v", ["help",
"output="])
except: # getopt.GetoptError:
# print help information and exit:
usage()
sys.exit(2)
output = None
verbose = False
for o, a in opts:
if o == "-v":
verbose = True
if o in ("-h", "--help"):
usage()
sys.exit()
if o in ("-o", "--output"):
output = a
# ...
if __name__ == "__main__":
main()