How to handle two-level option processing with optparse

R. Bernstein rocky at
Thu Jan 26 04:05:05 EST 2006

Giovanni Bajo suggests:

> If you call OptionParser.disable_interspersed_args() on your parser,
> it will stop parsing at the first positional argument, leaving other
> options unparsed.

Wow - that was a quick answer! Thanks - it works great!

I see how I missed this. Neither disable_.. or enable_.. have document
strings. And neither seem to described in the optparser section (6.21)
of the Python Library (

I wonder if something like this might be added to the Python Cookbook.

Thanks again.

More information about the Python-list mailing list