I often run scripts with ipython -i or ipython --pdb. I would like to make a script which parses arguments without interfering with being run in this manner. I've attempted to do this below in the file ipy_parse.py:
import argparse
parser = argparse.ArgumentParser()
parser.add_argument(
'-lf', '--proglogfile',
help="File for logging",
dest="plogfile",
type=str
)
args = parser.parse_args()
print(args.plogfile)
However, when I run this with ipython ipy_parse.py --proglogfile="wat", I get the following output:
[TerminalIPythonApp] WARNING | Unrecognized alias: '--proglogfile=wat', it will probably have no effect.
None
Despite the fact that this script works normally when run with python ipy_parse.py --proglogfile="wat". How can I parse arguments without interfering with IPython arguments?