Passing arbitrary strings is fine. As far as I know, optparse should handle any characters in the strings perfectly fine. The only thing it checks for is the string starting with -
For example:
calibre-debug -c 'import optparse; p = optparse.OptionParser(); print p.parse_args(["xx", "comment:ab-\n"])[1]'
['xx', 'comment:ab-\n']
If the string is being split up, it's probably happening elsewhere in the stack, probably in whatever library you are using to call processes.
|