Skip to content

Instantly share code, notes, and snippets.

@mgalgs
Created August 30, 2013 20:36
Show Gist options
  • Save mgalgs/6394024 to your computer and use it in GitHub Desktop.
Save mgalgs/6394024 to your computer and use it in GitHub Desktop.
ipython and optparse
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