import Python module when there is sibling file with the same name -
suppose have following files
tata/foo.py tata/yoyo.py foo/__init__.py foo/bar.py in file foo.py do
import foo.bar i run pythonpath=. python tata/yoyo.py , get
traceback (most recent call last): file "tata/yoyo.py", line 1, in <module> import foo.bar importerror: no module named bar issue disappears when delete tata/foo.py. please suggest way resolve situation when have global module name , local file name coincides.
use:
from __future__ import absolute_import
Comments
Post a Comment