Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Module Import Errors #193

Closed
vladimir-v-diaz opened this issue Feb 5, 2014 · 1 comment
Closed

Module Import Errors #193

vladimir-v-diaz opened this issue Feb 5, 2014 · 1 comment

Comments

@vladimir-v-diaz
Copy link

Numerous modules raise import errors.
Example:

>>> import warehouse.utils
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/vlad/projects/warehouse/warehouse/utils.py", line 26, in <module>
    from warehouse import helpers
  File "/home/vlad/projects/warehouse/warehouse/helpers.py", line 23, in <module>
    import warehouse.application
  File "/home/vlad/projects/warehouse/warehouse/application.py", line 49, in <module>
    from warehouse.packaging.search import ProjectMapping
  File "/home/vlad/projects/warehouse/warehouse/packaging/search.py", line 17, in <module>
    from warehouse.search.indexes import BaseMapping
  File "/home/vlad/projects/warehouse/warehouse/search/indexes.py", line 23, in <module>
    from warehouse.utils import AttributeDict
ImportError: cannot import name AttributeDict

Should Warehouse import modules instead of module members? Importing modules might help avoid resolving classes & functions at import-time, and raising import errors like in this circular import example.

@dstufft
Copy link
Member

dstufft commented Feb 28, 2014

Sorry for not getting back to you! I've had a busy couple of months. I would prefer not to try to "trick" the import system by import modules instead of module members. I think people should be free to use whichever makes the most sense at the time.

As to the exact issue here, PR #206 will solve that particular circular import and that's how I'd prefer to handle this going into the future, by fixing the circular imports where they happen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants