[issue6386] importing yields unexpected results when initial script is a symbolic link

Shriramana Sharma report at bugs.python.org
Mon May 27 18:05:33 CEST 2013


Shriramana Sharma added the comment:

I'm sorry but I don't get why this is a WONTFIX. I reported what is (now) apparently a dup: issue 18067. Just like the OP of this bug, I feel that in doing testing and such, one would naturally symlink and expect the library in the *current* directory to be imported. 

And about the CWD, I have demonstrated in issue 18067 how the CWD is in fact reported to be the directory of the *source* of the symlink (i.e. the dir containing the symlink inode) and not the *target* of the symlink. This is precisely what is frustrating about this bug: the fact that Python does not import something from a directory which it reports to be the current directory as per os.getcwd(). 

While I myself lack the internal CPython code knowledge to fix this, I can't imagine this would be too difficult to fix, given that os.getcwd() already reports the correct current directory -- in setting up the import path list, you just have to use that i.o. whatever else you are using now.

Thanks.

----------
nosy: +jamadagni

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue6386>
_______________________________________


More information about the Python-bugs-list mailing list