Charles-François Natali added the comment:

> I am not sure about what use cases could be broken by the above change, do 
> you have examples?
> Normal use cases of symbolic links have to do with linking entire folders, 
> not individual files, and that behaviour would not be broken by  such a 
> hypothetical change, I think.

For example:

/tmp/
    foo/
        foo.py
        libfoo.py

    foo.py -> /tmp/foo/foo.py

With foo.py containing "import libfoo".

Now, calling /tmp/foo.py works because sys.path[0] ==
dirname(realpath("/tmp/foo.py")) == dirname("/tmp/foo/foo.py") ==
"/tmp/foo.

If we change sys.path[0] to not dereference the symlink (that's how I
understood your suggestion, maybe I got it wrong), it will now be
/tmp, and importing libfoo will fail.

That's AFAICT exacyly the problem reported by the OP on OS-X.

----------
title: sys.path[0] when executed thru a symbolic link -> sys.path

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue1387483>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to