Cannot import module in python -
here's directory structure
.../desktop/scratch/abc/greet.py i have import code module.py in abc
.../desktop/scratch/module.py: import sys sys.path.append("c:\\users\\name\\desktop\\scratch") import abc.greet i have created empty init file in abc , greet folders.
but when run code error like:
traceback (most recent phone call last): file "<frozen importlib._bootstrap>", line 1519, in _find_and_load_unlocked attributeerror: 'module' object has no attribute '__path__' during handling of above exception, exception occurred: traceback (most recent phone call last): file "module.py", line 4, in <module> import abc.greet importerror: no module named 'abc.greet'; abc not bundle i don't understand why happens? how abc not module when have created init file , added scratch directory search path.
ps: greet.py contains method hello prints "hello world", if info of use.
python has module named abc. take different name.
python python-3.x python-import
No comments:
Post a Comment