[docs] [issue32573] sys.argv documentation should include caveat for embedded environments

Pedro report at bugs.python.org
Tue Jan 16 20:17:42 EST 2018

Pedro <pgacv2+pythonbugs at gmail.com> added the comment:

My first inclination would be no. An argv value of [''] means "zero command-line arguments" (not even a filename), which implies the following as far as I know:
1. Python was called as an executable rather than a library, because you can't pass command-line arguments to a library
2. No arguments were passed to the executable
3. You are running from inside the REPL

All three are false in an embedded context.

A not-much-better-but-maybe-worth-considering question might also be: should scripts be able to tell whether they are being run from an embedded interpreter? If so, do they have any other way of doing so if an initialization is forced for argv?


Python tracker <report at bugs.python.org>

More information about the docs mailing list