
Hi, you're quoting a long paragraph, I don't know what's wrong in it, let's try: Le 3/14/21 à 8:48 PM, guyrenebongers71 via docs a écrit :
it reads : when no script and no arguments are given, sys.argv[0] is an empty string.
$ python
import sys sys.argv [''] # This one looks OK
When the script name is given as '-' (meaning standard input), sys.argv[0] is set to '-'.
$ echo "print(__import__('sys').argv)" | python - ['-'] # This one looks OK too.
When -c command is used, sys.argv[0] is set to '-c'.
$ python -c 'print(__import__("sys").argv)' ['-c'] # This one is OK too.
When -m module is used, sys.argv[0] is set to the full name of the located module.
$ echo "print(__import__('sys').argv)" > argv.py $ python -m argv ['/tmp/argv.py'] Maybe this one? "full name" could be written "full path"?
Options found after -c command or -m module are not consumed by the Python interpreter’s option processing but left in sys.argv for the command or module to handle.
$ python -c "print(__import__('sys').argv)" foo bar ['-c', 'foo', 'bar'] # This one is true too. $ python -m argv foo bar ['/home/mdk/clones/python/python-docs-fr/argv.py', 'foo', 'bar'] # This one is true too. OOOhhhhhh I think I understand, you tried with ipython, not python, in which case it's the IPython documentation that should tell it's the full path, not the Python documentation, an I right? Bests, -- [Julien Palard](https://mdk.fr)