Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ---------------------------------------------------------------------------
- AttributeError Traceback (most recent call last)
- <ipython-input-1-bcae5a697dad> in <module>
- ----> 1 import namespace_repro.module
- ~/namespace-repro/src/namespace_repro/module/__init__.py in <module>
- ----> 1 from namespace_repro.module.x import x
- ~/namespace-repro/src/namespace_repro/module/x.py in <module>
- ----> 1 import namespace_repro.module.y as y
- 2
- 3 x = y.y
- AttributeError: module 'namespace_repro' has no attribute 'module'
- ---------------------------------------------------------------------------
- In [1]: import namespace_repro.module.y as y # This doesn't work.
- ---------------------------------------------------------------------------
- AttributeError Traceback (most recent call last)
- <ipython-input-4-4035347ea59b> in <module>
- ----> 1 import namespace_repro.module.y as y
- AttributeError: module 'namespace_repro' has no attribute 'module'
- In [2]: import namespace_repro.module.y # But this one does! Why?
- In [3]: dir(namespace_repro.module.y) # The error returns when we actually want to use the module.
- ---------------------------------------------------------------------------
- AttributeError Traceback (most recent call last)
- <ipython-input-3-d89bcfd9e509> in <module>
- ----> 1 dir(namespace_repro.module.y)
- AttributeError: module 'namespace_repro' has no attribute 'module'
- In [4]: from namespace_repro.module.y import y # This works fine!
- In [5]: y
- Out[5]: True
- . import-error-repro
- +-- setup.py
- +-- src
- | +-- namespace_repro
- | | +-- module
- | | | +-- __init__.py
- | | | +-- x.py
- | | | +-- y.py
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement