]> granicus.if.org Git - python/commitdiff
Issue #6386: When executing a script that's a symlink, the directory
authorBrett Cannon <brett@python.org>
Thu, 6 Feb 2014 14:22:51 +0000 (09:22 -0500)
committerBrett Cannon <brett@python.org>
Thu, 6 Feb 2014 14:22:51 +0000 (09:22 -0500)
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.

Doc/tutorial/modules.rst
Misc/NEWS

index 94a66ac698d7d75ccb0b678b0d80b81304c15f97..fd361aed695a71d662566b51677d1d926e53dac4 100644 (file)
@@ -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
index 5403a6abb9bab1ec74da73954777ca62900bf2f4..c963c83f4da1ce9f8ee486473737701545e5fb89 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -163,6 +163,13 @@ Build
 
 - Issue #20465: Update SQLite shipped with OS X installer to 3.8.3.
 
+Documentation
+-------------
+
+- Issue #6386: Clarify in the tutorial that specifying a symlink to execute
+  means the directory containing the executed script and not the symlink is
+  added to sys.path.
+
 
 What's New in Python 3.4.0 Beta 3?
 ==================================