jparise / python-reloader

Dependency-based Python Module Reloader
http://www.indelible.org/ink/python-reloading/
MIT License
135 stars 27 forks source link

support import of modules under packages missing attributes #20

Closed kouk closed 10 years ago

kouk commented 10 years ago

In some cases a package is loaded that doesn't have all it's descendants as attributes. When importing a descendant with fromlist == None then an AttributeError is thrown in _import. This is the case for example when importing django.template.defaulttags.

The proposed fix is to use sys.modules with the full name of the immediate ancestor of the module, but only if the current method trows an AttributeError.

jparise commented 10 years ago

Thanks, @kouk!