problem with import / namespace

ohad frand ohad911 at gmail.com
Wed May 21 07:51:56 EDT 2008


Hi
I have a problem that the solution to it must be very simple but i couldnt
fint it's answer in the internet so far (i searched for couple of days)
the problme is as follows:

i have two directories e.g. "\\1" and "\\2"
in each directory i have two files with the same names e.g. "tmp1.py" and
"tmp2.py"
each tmp2.py file imports tmp1 from its same directory (import tmp1) - thats
the problem
if i execute one file (\\1\tmp2.py) than the execution is ok
but when i try after that to execute the second file (\\2\tmp2.py) than the
tmp1 file from the wrong directory ( - directory 1 in this case) is imported
instead.
i tried many things to try to solve it, i removed the previous path from
sys.path and added the new one, i tried to change current working directory
with os.chdir()
I tried to delete from locals and from globals the name tmp1 before running
the second file but nothing worked.
please help

Thanks,
Ohad
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20080521/da551209/attachment.html>


More information about the Python-list mailing list