[Jupyter Notebook Error]ipykernel_launcher.py: error: unrecognized arguments: -f

Error Message: ipykernel_launcher.py: error: unrecognized arguments: -f

ipykernel_launcher.py: error: unrecognized arguments: -f /home/user/.local/share/jupyter/runtime/kernel-18e9ff2f-89c2-4bad-b60d-68c374395f6b.json

An exception has occurred, use %tb to see the full traceback.

SystemExit: 2

/home/user/conda/lib/python3.6/site-packages/IPython/core/interactiveshell.py:3351: UserWarning: To exit: use 'exit', 'quit', or Ctrl-D.
  warn("To exit: use 'exit', 'quit', or Ctrl-D.", stacklevel=1)

Reason: using argparse in Jupyter Notebook

Quik Fix

Parse an empty string to parser().parse_args(), i.e.

change

parser = argparse.ArgumentParser()
args = parser.parse_args()

to

parser = argparse.ArgumentParser()
args = parser.parse_args('')

Leave a Reply Cancel reply