I'm trying to print the GetoptError message that I get if I don't use the try-except construction, but it won't work: try: opts, args = getopt.getopt(sys.argv[1:], "c:d:h:") except getopt.GetoptError: print getopt.GetoptError.msg sys.exit(2) All I get is an empty string. What is wrong here? Regards, Gustaf Liljegren