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 kristjan.jonsson
Recipients jackjansen, kowaltowski, kristjan.jonsson
Date 2013-04-04.14:34:15
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1365086055.58.0.588039246332.issue1387483@psf.upfronthosting.co.za>
In-reply-to
Content
Just came across this when running hadoop jobs
it takes your .py script folder, puts each file in its own cache folder, then recreates the script folder populating it with individual symlinks.
When run like this, the scripts can no longer import each other, because sys.path[0] is set to the "real" place of the file, rather than the place it was invoked from.

I just reproed this with python 2.7.3 on a new ubuntu system:

repro:
mkdir pydir
mkdir pydir/lnk
echo "import sys; print ">", sys.path[0]" >> pydir/lnk/test.py
lndir -s lnk/test.py pydir/test.py
python pydir/test.py
> /home/kristjan/pydir/lnk

You would have expected "/home/kristjan/pydir" since this is the apparent directory of the file.  When "pydir" contains many .py files, each residing in their own unique real target directories, then they cannot import each other.
History
Date User Action Args
2013-04-04 14:34:15kristjan.jonssonsetrecipients: + kristjan.jonsson, jackjansen, kowaltowski
2013-04-04 14:34:15kristjan.jonssonsetmessageid: <1365086055.58.0.588039246332.issue1387483@psf.upfronthosting.co.za>
2013-04-04 14:34:15kristjan.jonssonlinkissue1387483 messages
2013-04-04 14:34:15kristjan.jonssoncreate