Message190167
> 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. |
|
Date |
User |
Action |
Args |
2013-05-28 01:56:05 | jamadagni | set | recipients:
+ jamadagni, brett.cannon, ncoghlan, matejcik, r.david.murray, jbeulich, BreamoreBoy, eric.snow |
2013-05-28 01:56:05 | jamadagni | set | messageid: <1369706165.64.0.966524911155.issue6386@psf.upfronthosting.co.za> |
2013-05-28 01:56:05 | jamadagni | link | issue6386 messages |
2013-05-28 01:56:04 | jamadagni | create | |
|