diff options
author | Brett Cannon <brett@python.org> | 2014-02-06 14:22:51 (GMT) |
---|---|---|
committer | Brett Cannon <brett@python.org> | 2014-02-06 14:22:51 (GMT) |
commit | f811bbfe6c41d90dd1ad1c68d05a84541ecdf162 (patch) | |
tree | 8870590cb4f214755b82d3bf3fac513078073793 /Doc/tutorial | |
parent | 94e44a935b3dc1e67a6a3357f64324ee0c81d40c (diff) | |
download | cpython-f811bbfe6c41d90dd1ad1c68d05a84541ecdf162.zip cpython-f811bbfe6c41d90dd1ad1c68d05a84541ecdf162.tar.gz cpython-f811bbfe6c41d90dd1ad1c68d05a84541ecdf162.tar.bz2 |
Issue #6386: When executing a script that's a symlink, the directory
where the symlink resolves to is added to sys.path, not the directory
containing the symlink itself.
Thanks to Sanko Resic for an initial attempt at the patch.
Diffstat (limited to 'Doc/tutorial')
-rw-r--r-- | Doc/tutorial/modules.rst | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/Doc/tutorial/modules.rst b/Doc/tutorial/modules.rst index 94a66ac..fd361ae 100644 --- a/Doc/tutorial/modules.rst +++ b/Doc/tutorial/modules.rst @@ -165,10 +165,16 @@ a built-in module with that name. If not found, it then searches for a file named :file:`spam.py` in a list of directories given by the variable :data:`sys.path`. :data:`sys.path` is initialized from these locations: -* the directory containing the input script (or the current directory). +* The directory containing the input script (or the current directory when no + file is specified). * :envvar:`PYTHONPATH` (a list of directory names, with the same syntax as the shell variable :envvar:`PATH`). -* the installation-dependent default. +* The installation-dependent default. + +.. note:: + On file systems which support symlinks, the directory containing the input + script is calculated after the symlink is followed. In other words the + directory containing the symlink is **not** added to the module search path. After initialization, Python programs can modify :data:`sys.path`. The directory containing the script being run is placed at the beginning of the |