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:
>>>
>>> ERROR2013-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
>>>
>>> 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.
>>>
>>> ERROR2013-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
>>>
>>> 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
>>>
>>> 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
>>> 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
>>> 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
>>> 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
>>> 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
>>>
>>> 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*
>>>
>>> N