Book Image

Python Essentials

By : Steven F. Lott
Book Image

Python Essentials

By: Steven F. Lott

Overview of this book

Table of Contents (22 chapters)
Python Essentials
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Seeing the package search path


The Python search path can be seen by importing the sys package to see sys.path:

>>> import sys
>>> sys.path
['', '/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/setuptools-2.0.2-py3.3.egg',
…, etc.
'/Library/Frameworks/Python.framework/Versions/3.3/lib/python33.zip',
'/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3',
'/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/plat-darwin',
'/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/lib-dynload',
'/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages']

We've elided a number of lines from this output to show the essentials of how the standard library fits into the way we develop Python code. This list of places to search for modules is built by the sites package when Python starts running.

The zero-length directory name, '', is first. This means that the current working directory is the preferred...