This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author jamadagni
Recipients BreamoreBoy, brett.cannon, eric.snow, jamadagni, jbeulich, matejcik, ncoghlan, r.david.murray
Date 2013-05-28.01:56:04
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1369706165.64.0.966524911155.issue6386@psf.upfronthosting.co.za>
In-reply-to
Content
> The current behaviour is also needed to sanely support Python 
> scripts symlinked from Linux /bin directories.

OK that clinched it for me -- I can't argue against that! And obviously it is not meaningful to copy/symlink *all* the current-directory modules a particular script depends upon to the symlink directory as well. And searching both directories (containing the source and target of the symlink) is not good for security I guess.

And I also checked the contents of sys.path with my test case -- and sure enough the directory corresponding to the actual output was printed. Just that sys.path is different from os.getcwd() needs some effort to bring into mind.

So I think someone should please clearly mention this behaviour in the documentation under http://docs.python.org/3/tutorial/modules.html#the-module-search-path and the Py2 equivalent. Specifically this point needs clarification:

""the directory containing the input script (or the current directory).""

It would be best to remove the text in parantheses (which immediately makes one think of os.getcwd()) and add a clarification like:

Note that on filesystems that support symlinks, this means the directory containing the actual script file. Symlinks to the script may be present elsewhere and may be used to invoke the script, but the directories containing those symlinks will *not* be searched for dependency modules.

Thank you very much for these clarifications and for your work on Python! Please do add the above documentation clarification, though.
History
Date User Action Args
2013-05-28 01:56:05jamadagnisetrecipients: + jamadagni, brett.cannon, ncoghlan, matejcik, r.david.murray, jbeulich, BreamoreBoy, eric.snow
2013-05-28 01:56:05jamadagnisetmessageid: <1369706165.64.0.966524911155.issue6386@psf.upfronthosting.co.za>
2013-05-28 01:56:05jamadagnilinkissue6386 messages
2013-05-28 01:56:04jamadagnicreate