How to use optparse without the command line?
marko.loparic at gmail.com
Thu Apr 7 04:37:39 EDT 2011
Is there support/idioms/suggestions for using optparse without a
I have a code which used to be called through subprocess. The whole
flow of the code is based on what 'options' object from optparse
Now I want to call this code without subprocessing. What I did first
was to build a "fake" command-line and use
options, args = parser.parse_args(fake_cmdline)
But I find it dumb to encode and decode a dictionary... So I would
like to know how I if there is a good way of passing a dictionary to
optparse and benefiting from its option management (check, error
Thanks a lot!
More information about the Python-list