The problem is this code in custom_import.py

    # if not relative and not from applications:
    if hasattr(current, 'request') \
            and level <= 0 \
            and not name.split('.')[0] in INVALID_MODULES \
            and isinstance(globals, dict):

"import nltk.data" goes through, but it shouldn't. Why could that be? (I do 
not understand the code very well)

On Monday, January 14, 2013 11:52:26 AM UTC+1, Daniel Gonzalez wrote:
>
> Version 2.3.2 (2012-12-17 08:59:58) stable, commit 9557c46, in Ubuntu 
> 12.04.1 LTS. I am running from a virtualenv with python 2.7.2.
>
> I have no idea how to force nltk to be found: the sys.path is correct, as 
> I have verified by setting manually in the interpreter and running the 
> import statement. That is why I mean this is a "strange" error: everything 
> seems to be set up correctly, but running from web2py I get an import 
> error, and doing the same thing directly in the interpreter does not.
>
> I am taking a look at the custom_importer: I do no know why this import is 
> falling to line 77 (if I understand correctly, that part is doing the 
> custom web2py modules/models/controllers importing). It should go to line 
> 96:
>
>     return NATIVE_IMPORTER(name, globals, locals, fromlist, level)
>
> since nltk.data is a system import. It has nothing to do with web2py.
>
> On Monday, January 14, 2013 11:42:10 AM UTC+1, Alan Etkin wrote:
>>
>> I have a problem with an import in my model:
>>>
>>
>> What version are you running?, in what OS?. As a temporary workaround and 
>> If it's a path error you can try fixing sys.path so nltk is found. 
>>
>

-- 



Reply via email to