2

I just installed the git master branch of IPython. The following:

In [1]: run -m my_packages.my_module -verbosity 20

returns an error:

UsageError: option -v not recognized ( allowed: "nidtN:b:pD:l:rs:T:em:G" )

Even though the following works:

$ python -m my_packages.my_module -verbosity 20

I am using argparse as follows:

parser = argparse.ArgumentParser(description='my_program')
parser.add_argument('-verbosity',   help='Verbosity', required=True)

Any thoughts why?

4

1 回答 1

4

Add -- to stop the command-line parsing at a certain point:

In [1]: %run -m my_packages.my_module -- -verbosity 20

This is standard behavior used by argparse for adding extra positional arguments.

于 2013-07-18T00:05:22.877 回答