On Sun, Jan 25, 2009 at 7:03 PM, Todd O'Bryan <toddobr...@gmail.com> wrote:
> > I've been trying to convert my apps to use the relative imports from > __future__ and have noticed a problem. I think it may be something > Django is doing, but I'm not sure. > > In the __init__.py module inside an app, I have > > from __future__ import absolute_import > > from ..another_app.models import blah > > This causes an error when I try to load a page that uses it, with the > error message: > > No module named another_app.models > > I looked up the absolute_import PEP, and it uses the __name__ value to > figure out relative imports. So I tried printing __name__. When the > file is first imported, the name is 'project.app', but later on, after > the server starts running (and when it causes the error in > page-loading) the name has changed to 'project.app.' with an extra dot > at the end. > > Is Django doing this or is it happening in the bowels of my code > somewhere? If Django is doing this, does it have to since it will mess > up absolute_import users? > Sounds related to: http://code.djangoproject.com/ticket/8193 Karen --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---