Created
August 30, 2013 20:36
-
-
Save mgalgs/6394024 to your computer and use it in GitHub Desktop.
ipython and optparse
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In [1]: from optparse import OptionParser | |
In [2]: parser = OptionParser() | |
In [3]: parser.add_option("", "--cpu-state") | |
Out[3]: <Option at 0x1556fc8: --cpu-state> | |
In [4]: args = ["--stuff", "--cpu-state"] | |
In [5]: options, args = parser.parse_args(args) | |
Usage: ipython2 [options] | |
ipython2: error: no such option: --stuff | |
An exception has occurred, use %tb to see the full traceback. | |
SystemExit: 2 | |
To exit: use 'exit', 'quit', or Ctrl-D. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment