I tried switching from `optparse` to `argparse`, but ended up reverting back because `argparse` does not respect double quotes. For example, `optparse` correctly parses the following, while `argparse` does not: python myprog.py --ng --INP="Demo IO" (`argparse` splits "Demo" and "IO" into separate tokens).
Hello Steven, I'm embarrassed to report that I can't reproduce the problem. The input line is parsed correctly if I enclose the string 'Demo IO' in double quotes. It is parsed incorrectly if I enclose it in single quotes, but it looks as though this is the fault of the Windows shell, and not Python. My apologies. Phillip On Thu, Dec 15, 2011 at 2:22 AM, Steven Bethard <report@bugs.python.org> wrote: > > Steven Bethard <steven.bethard@gmail.com> added the comment: > > Can you submit some example code that shows this? I can't reproduce this with: > > ---------- temp.py ---------- > import argparse > > parser = argparse.ArgumentParser() > parser.add_argument("--ng", action="store_true") > parser.add_argument("--INP") > print(parser.parse_args()) > ------------------------------ > > $ python temp.py --ng --INP="Demo IO" > Namespace(INP='Demo IO', ng=True) > > ---------- > > _______________________________________ > Python tracker <report@bugs.python.org> > <http://bugs.python.org/issue13584> > _______________________________________