Some modules do something very weird. Some of them have conditional imports 
and some assume they are installed in a certain location. I wish this was 
handled better by Python.

On Thursday, 25 July 2013 14:03:23 UTC-5, Quint wrote:
>
> Thanks!
>
> Ok, *openid *and *python-social_auth* are now working.
> I indeed needed to install the openid properly and copied the result to my 
> project. (i was stupid and thought i could just copy over the source 
> files...)
>
> Only *nltk *still won't import. I installed using pip and now i can 
> import it outside of my project but not in my GAE/W2P environment.
>
> Maybe is has something to do with the way nltk imports it's submodules in 
> __init__?
>
> On Thursday, July 25, 2013 7:17:44 PM UTC+2, Massimo Di Pierro wrote:
>>
>> When not on GAE, if you properly pip install the packages, do they work 
>> as expected?
>>
>> On Thursday, 25 July 2013 11:50:02 UTC-5, Quint wrote:
>>>
>>> Hi,
>>>
>>> I'm using *GAE with the development server* and i'm unable to import 
>>> several external modules. 
>>>
>>>
>>> I will try to list the modules i'm trying to import and the problems i 
>>> encounter with it:
>>>
>>> *python-social-auth*
>>>
>>> https://github.com/omab/python-social-auth/
>>>
>>> I put this module in the site-packages folder and in one of my models i 
>>> get this error when i import it:
>>>
>>> ERROR    2013-07-25 15:57:16,092 restricted.py:161] Traceback (most 
>>> recent call last):
>>>   File "C:\Users\*****\gluon\restricted.py", line 212, in restricted
>>>     exec ccode in environment
>>>   File "C:\Users\*****\applications\init\models\bl.py", line 11, in 
>>> <module>
>>>     from social.storage.base import UserMixin, BaseStorage
>>>   File "C:\Users\*****\gluon\custom_import.py", line 87, in 
>>> custom_importer
>>>     return base_importer(pname, globals, locals, fromlist, level)
>>> ImportError: No module named social.storage.base
>>>
>>> python-social-auth depends on *python-openid*.
>>>
>>> When i put python-social-auth in the "modules"folder it fails to import 
>>> openid. (which i have put in the "site-packages-folder")
>>> When they are both in the "modules" folder, openid import fails.
>>> When they are both in the site-packages folder, it seems that 
>>> social-auth is able to import openid but i cannot import python-social-auth 
>>> from my model.
>>>
>>> ERROR    2013-07-25 16:06:40,910 restricted.py:161] Traceback (most 
>>> recent call last):
>>>   File "C:\Users\*****\gluon\restricted.py", line 212, in restricted
>>>     exec ccode in environment
>>>   File "C:\Users\*****\applications\init\models\bl.py", line 11, in 
>>> <module>
>>>     from social.storage.base import UserMixin, BaseStorage
>>>   File "C:\Users\*****\gluon\custom_import.py", line 87, in 
>>> custom_importer
>>>     return base_importer(pname, globals, locals, fromlist, level)
>>>   File "applications\init\modules\social\storage\base.py", line 7, in 
>>> <module>
>>>     from openid.association import Association as OpenIdAssociation
>>>   File "C:\Users\*****\gluon\custom_import.py", line 87, in 
>>> custom_importer
>>>     return base_importer(pname, globals, locals, fromlist, level)
>>> ImportError: No module named openid.association
>>>
>>> *nltk*
>>>
>>> stored in "site-packages" folder:
>>>
>>> Traceback (most recent call last):
>>>   File "C:\Users\*****\gluon\restricted.py", line 212, in restricted
>>>     exec ccode in environment
>>>   File "C:\Users\*****\applications\init\controllers/api.py", line 15, 
>>> in <module>
>>>     from summary import summarize
>>>   File "C:\Users\*****\gluon\custom_import.py", line 87, in 
>>> custom_importer
>>>     return base_importer(pname, globals, locals, fromlist, level)
>>>   File "applications\init\modules\summary.py", line 9, in <module>
>>>     import nltk
>>>   File "C:\Users\*****\gluon\custom_import.py", line 81, in 
>>> custom_importer
>>>     raise ImportError, 'Cannot import module %s' % str(e)
>>> ImportError: Cannot import module 'nltk'
>>>
>>> stored in "modules" folder:
>>>
>>> Traceback (most recent call last):
>>>   File "C:\Users\*****\gluon\restricted.py", line 212, in restricted
>>>     exec ccode in environment
>>>   File "C:\Users\*****\applications\init\controllers/api.py", line 15, 
>>> in <module>
>>>     from summary import summarize
>>>   File "C:\Users\*****\gluon\custom_import.py", line 87, in 
>>> custom_importer
>>>     return base_importer(pname, globals, locals, fromlist, level)
>>>   File "applications\init\modules\summary.py", line 9, in <module>
>>>     import nltk
>>>   File "C:\Users\*****\gluon\custom_import.py", line 77, in 
>>> custom_importer
>>>     modules_prefix, globals, locals, [itemname], level)
>>>   File "applications\init\modules\nltk\__init__.py", line 107, in 
>>> <module>
>>>     from featstruct import *
>>>   File "C:\Users\*****\gluon\custom_import.py", line 87, in 
>>> custom_importer
>>>     return base_importer(pname, globals, locals, fromlist, level)
>>> ImportError: No module named featstruct
>>>
>>> *BeautifulSoup*
>>>
>>> Not a big problem because there is a workaround. but still...
>>>
>>> Same issue as this one:
>>>
>>> https://groups.google.com/forum/#!searchin/web2py/import$20beautifulsoup/web2py/cGoffihBPTk/sxxLpgfcQcYJ
>>>
>>> Only i'm using W2P source version on GAE dev server.
>>> I need to import bs2 twice using try/except and the second time it 
>>> succeeds.
>>>
>>> I really hope someone can help with this. I cannot import these modules 
>>> so i cannot proceed with my project.
>>>
>>> Thanks!
>>>
>>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to