ipykernel_launcher.py: error: the following arguments are required: -m/--mode

Viewed 2495

I have a long code and I keep getting this error when I run it. does anyone know what is this error about?

` usage: ipykernel_launcher.py [-h] -m MODE

ipykernel_launcher.py: error: the following arguments are required: -m/--mode

An exception has occurred, use %tb to see the full traceback.
 
SystemExit: 2`
2 Answers

From the ipython help:

ipython [subcommand] [options] [-c cmd | -m mod | file] [--] [arg] ...

So we can call a script that echos sys.argv with:

0812:~/mypy$ ipython echo.py -- foo bar
['/home/paul/mypy/echo.py', 'foo', 'bar']

or to stay in an interactive session:

0812:~/mypy$ ipython echo.py -- foo bar
['/home/paul/mypy/echo.py', 'foo', 'bar']
0824:~/mypy$ ipython -i echo.py -- foo bar
Python 3.6.9 (default, Jul 17 2020, 12:50:27) 
Type 'copyright', 'credits' or 'license' for more information
IPython 7.16.1 -- An enhanced Interactive Python. Type '?' for help.
['/home/paul/mypy/echo.py', 'foo', 'bar']

In [1]: sys.argv
Out[1]: ['/usr/local/bin/ipython', '-i', 'echo.py', '--', 'foo', 'bar']

sys.argv contains the commandline strings that your argparse parser will process. Just provide the values it expects (as specified in the usage).

i have same error while running jupyter notebook how to resolve this error.

  1. open command line interface.
  2. copy the path where your python is been installed.
  3. write cd in command line interface and past the path of installed python exe.
  4. while entering to that path in command line interface after that write command pip install jupyter after that wait for a moment to install new version of jupyter.
Related