[Tutor] module not found problem

Luke Paireepinart rabidpoobear at gmail.com
Tue Sep 22 20:09:06 CEST 2009


It looks to me like your __init__.py is transparently
mapping openid.extensions.pape to openid.extensions.pape5 but when you try
to do a direct import from openid.extensions.pape it doesn't process the
__init__.py.  I've never seen something like this but from your example
that's my first guess.Try doing
from openid.extensions.pape5 import PageRequest

I would guess the way you're expected to do it is just
from openid.extensions import pape

and if you don't want to refer to PageRequest as pape.PageRequest
just do
PageRequest = pape.PageRequest

That doesn't sound quite right though....

On Tue, Sep 22, 2009 at 7:56 PM, Parag Shah <adaptives at gmail.com> wrote:

> Hi,
>
> I am using django-openid-consumer, which has a line in it's views.py
> which results in an error due to module not found -
>
> from openid.extensions.pape import Request as PapeRequest
>
> where 'openid.extensions' comes from python-openid-2.2.4 (installed
> using 'python setup.py install'), which has an 'extensions' directory,
> but no 'pape' directory. However, 'extensions' has an __init__.py
> which seems to be importing 'pape', like this:
>
> __all__ = ['ax', 'pape', 'sreg']
> from openid.extensions.draft import pape5 as pape
>
>
> However, the Django app still gives me an error when the line which
> required pape is executed. I started the Python prompt and tried the
> following:
>
> >>> from openid.extensions import pape
> >>> from openid.extensions.pape import PageRequest
> Traceback (most recent call last):
>  File "<stdin>", line 1, in <module>
> ImportError: No module named pape
>
>
> So Python is able to execute the first import which just imports
> 'pape', but fails on the second import which imports 'PageRequest'
> from 'pape'.
>
> Can someone point out what the problem may be.
>
> --
> Thanks & Regards
> Parag Shah
> http://blog.adaptivesoftware.biz
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20090922/6d593071/attachment.htm>


More information about the Tutor mailing list