Aug-01-2022, 06:53 AM
(This post was last modified: Aug-01-2022, 06:53 AM by Gribouillis.)
(Jul-31-2022, 11:16 PM)Skaperen Wrote: this is unclear. at first it says it is automatic. then it says what to call. is coding such a call going to suppress the automatic import?I think it is very clear:
- If the
python
executable is invoked without the -S command line switch, the site module is automatically imported and site-specific paths are appended to the module search path.
- If
python -S
is invoked, this doesn't happen, but your code can useimport site
, and the site-specific paths are appended only if you code callssite.main()
.
(Jul-31-2022, 11:16 PM)Skaperen Wrote: Changed in version 3.5: Support for the “site-python” directory has been removed.In the past, there was a directory
lib/site-python
on Unix and Mac. This directory no longer exists.(Jul-31-2022, 11:16 PM)Skaperen Wrote: is there an explanation of how things get run when doing a command with the -m option? are arguments in sys.argv as is done for normal commands? is there an advantage to making a command/script be run this way?The advantage is that a python library can be used as a python program. You don't need to write a module plus an executable script. For the effect of the -m switch on sys.argv, here is the doc.
Skaperen Wrote:i just want to have a place to put modules in that may be for user coded scripts run from their home directoriesI suggest $HOME/.local/bin