[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

argparse question

I have been reading the argparse section of the 3.3 docs, and running all the example code.

But in section for the formatter_class, the second example in that section 
illustrating RawDescriptionHelpFormatter, the example code is:

parser = argparse.ArgumentParser(
         Please do not mess up this text!
             I have indented it
             exactly the way
             I want it

But trying to run this gives a NameError on the "description=" line, saying textwrap is not 
defined.  If I delete the "textwrap.dedent" (with or without also deleting the extra 
parentheses) it will then run, but without the un-indenting it is trying to illustrate.

What is the proper way to enable the dedent() method here?

All the other examples have run correctly (that is, the one's I've tried -- I'm still reading).
Also, it should be obvious that while the "import argparse" line is not shown in the examples, 
it IS in the code samples I've been running.

Using 3.3 under Linux (Mint 15).

      -=- Larry -=-