Python Forum
looking fo documentation for module files
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
looking fo documentation for module files
#14
(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 use import site, and the site-specific paths are appended only if you code calls site.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 directories
I suggest $HOME/.local/bin
Reply


Messages In This Thread
RE: looking fo documentation for module files - by Gribouillis - Aug-01-2022, 06:53 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  finding which source files import a module Skaperen 3 2,637 Apr-22-2019, 09:28 PM
Last Post: Gribouillis

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020