[IPython-dev] Argument parsing (was: Qt api selection re. ipython and matplotlib)
Robert Kern
robert.kern at gmail.com
Thu Jul 7 12:55:20 EDT 2011
On 7/7/11 11:32 AM, MinRK wrote:
> On Thu, Jul 7, 2011 at 07:00, Darren Dale<dsdale24 at gmail.com> wrote:
>> Or, suppose I have a file named something pathological like foo=bar?
>> Python will run it without any problems. Even if I rename it
>> foo=bar.py, ipython appears to interpret it as an option, not a
>> filename.
>
> You can always give more path information, so `ipython ./profile` or
> `ipython ./foo=bar` will work*. Python has the exact same
> vulnerability to pathological filenames matching their argument
> patterns, like files called '-foo' or '-zebulon'. Obviously, given our
> more flexible syntax, our cases cast a wider net.
Well, with argparse, you can use the standardized "--" marker to indicate that
everything following is an argument, not an option. E.g.
$ ipython -pylab -- -foo.py
--
Robert Kern
"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
More information about the IPython-dev
mailing list