[issue6386] importing yields unexpected results when initial script is a symbolic link
Brett Cannon
report at bugs.python.org
Thu Apr 18 21:23:17 CEST 2013
Brett Cannon added the comment:
In case someone wants to reproduce:
mkdir pkg
echo "import tester" > pkg/symlinked.py
ln -s pkg/symlinked.py linked.py
echo "print('HIT')" > tester.py
That fails because Python assumes you are in the pkg directory, not the directory you started execution. This makes sense to me. If you used a hard link then this isn't a problem. Python treats a symlink as a redirect, which means it works where the redirect tells it to and doesn't try to confuse things by considering 2 different locations to be the cwd for imports.
Closing as "won't fix" since I think it would be more confusing to support both a symlink directory and the cwd.
----------
assignee: -> brett.cannon
resolution: -> wont fix
status: open -> closed
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue6386>
_______________________________________
More information about the Python-bugs-list
mailing list