Double quotes stripped from code by argparse on windows #10091

davclark opened this Issue Dec 15, 2016 · 1 comment


None yet

2 participants


I suspect this is a known issue, but it just came up on the rpy2 issue tracker. On windows, argparse appears to strip double quotes out everywhere.

There is an OLD issue on the python issue tracker about problems with double quotes, but the OP couldn't reproduce. I think it's an obscure corner-case, as it's a PITA to get double-quotes to pass through the windows shell to python from the command line.

In any case, is there any interest in fixing this bug at the IPython level? I am less familiar with the nuances of argparse, so I'm starting here. Perhaps it's a bug for the core python devs.

For reference, here's an easy way to elicit the bug on windows (the error is somewhat inscrutable, but you'll see the reported R code is lacking the quotes):

In [1]: %load_ext rpy2.ipython
In [2]: %R formatC(c(3.24, 2.3e-6), format = "f")

Yuck. There are definitely times when we regret the way that magics mix command line syntax and programming languages.

Does this only affect magics using argparse? Can someone try on Windows with e.g. %timeit, which uses the simpler self.parse_options() mechanism.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment