View Single Post
Old 02-07-2014, 06:51 AM   #9
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 45,201
Karma: 27110894
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
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.
kovidgoyal is online now   Reply With Quote