Dear lazyweb, I’m writing an application with Python and GTK+, and I’d like to parse command line arguments. I was thinking of using the PyGTK wrapped version of the Glib option parser, but I can’t find any tutorial for PyObject or application that uses it. Should I just use Python’s optparse instead?
We use optparse in Virtaal (and basically all of the Translate Toolkit). I can’t think of a reason why you wouldn’t want to use that.
nice alternative: http://code.google.com/p/argparse/ – parses both arguments and options
Yes, use optparse.
Pingback: Leonardo Ferreira Fontenelle: Parsing options in a PyGTK application | Full-Linux.com
Another vote for argparse. It does the whole job — positional arguments, and options, sub-commands — with a very nice API. It’s all in a single file, so you can bundle argparse.py, should you choose.