[Tutor] module not found problem

Parag Shah adaptives at gmail.com
Tue Sep 22 20:27:27 CEST 2009


Hi Luke,

If I get into the Python prompt, the following line does succeed (so
it seems like __init__.py is being processed):

>>> from openid.extensions import pape

But this one fails because pape is not found... this is very strange:
>>> from openid.extensions.pape import Request as PapeRequest

As you suggested I tried this, but it too fails:
>>> from openid.extensions.pape5 import Request as PapeRequest

However, doing this succeeds:
>>> from openid.extensions.draft.pape5 import Request as PapeRequest


-- 
Thanks & Regards
Parag Shah
http://blog.adaptivesoftware.biz

On 9/22/09, Luke Paireepinart <rabidpoobear at gmail.com> wrote:
> 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
>>
>


More information about the Tutor mailing list