[Tutor] accessing modules found throughout a package?

Ben Finney ben+python at benfinney.id.au
Sun Oct 18 14:57:33 EDT 2015


Ben Finney <ben+python at benfinney.id.au> writes:

> * Python will automatically add a ‘sys.path’ entry for the directory
>   containing the script named on the command line. So this:
>
>       $ cd ~/Projects/lorem/
>       $ python3 ./setup.py test
>
>   will run the ‘setup.py’ program with ‘sys.path’ already modified to
>   contain the directory ‘/home/YOURUSERNAME/Projects/lorem’. Any
>   packages in that directory are available for absolute import, *during*
>   that test suite run.

This behaviour is detailed further in the documentation
<URL:https://docs.python.org/3/using/cmdline.html#using-on-interface-options>.

-- 
 \      “The way to build large Python applications is to componentize |
  `\             and loosely-couple the hell out of everything.” —Aahz |
_o__)                                                                  |
Ben Finney



More information about the Tutor mailing list