I'm having a very similar issue :

If I do :

from geocoder import api

it works fine but if I do :

from plugin_geocomplete.geocoder import api

then the api.py module isn't detected by gluon custom importer

It's the exact same package but changing the namespace provides different 
results.
In my case, the annoying part is that because of this bug, I can't put the 
geocoder library in the correct folder in order for it to be packed with my 
plugin.


Extra tests show that deleting the .pyc files in the package's library 
(e.g. deleting api.pyc) allows the import to run correctly once.
Refresh the page and it's buggy again ('Cannot import name api')



On Thursday, March 7, 2013 11:43:50 AM UTC+1, Daniel Gonzalez wrote:
>
> Moving to 2.4.2 did not solve the issue. What did solve it was a 
> reorganizing of my libraries: previously I was importing libraries from a 
> top-level directory, and now I have put all my libraries inside a new 
> namespace, so that instead of doing:
>
> from my_module import my_function
>
> Now I am doing:
>
> from top_namespace.my_module import my_funcion
>
> And the issues are gone. I suspect one of my libraries was conflicting 
> with one the modules provided by web2py, but have no prove of that.
>
> On Wednesday, March 6, 2013 7:53:26 PM UTC+1, Daniel Gonzalez wrote:
>>
>> Currently running Version 2.4.1-alpha.2+timestamp.2013.01.13.13.14.47
>>
>> And I remember that I had a similar issue, which was indeed related to 
>> the custom importer:
>> https://groups.google.com/d/topic/web2py/IzhnixOivic/discussion
>>
>> It seems I am run into a similar problem again. If I find any information 
>> I'll post it. Otherwise I'll move to 2.4.2 and see if that solves the 
>> problems.
>>
>> On Wednesday, March 6, 2013 7:41:23 PM UTC+1, Massimo Di Pierro wrote:
>>>
>>> Which web2py version? Some changes were made to 2.4.2 to the custom 
>>> importer.
>>>
>>> On Wednesday, 6 March 2013 12:19:32 UTC-6, Daniel Gonzalez wrote:
>>>>
>>>> Hi,
>>>>
>>>> I have this very strange issue: I am importing a module in the web2py 
>>>> models, but the module can not be found.
>>>> This is only happening in one of my production hosts: the rest are ok 
>>>> (very similar machines, similar setup).
>>>> If I import the module from a python shell, it works, but importing 
>>>> from the web2py shell fails.
>>>> I have verified that os.environ.get('PYTHONPATH') are exactly the same 
>>>> in both web2py shell and normal python shell.
>>>>
>>>> sys.path differ slightly: basically, in web2py shell it has the web2py 
>>>> installation directory, and in the normal python shell it has the current 
>>>> directory.
>>>> But this should not affect finding the module I want to import. So, I 
>>>> do not understand why this one module is not being found. 
>>>>
>>>> I have experienced in the past that web2py complains about a module not 
>>>> found, when actually what happens is that importing that module causes an 
>>>> error (for whatever reason: because an import there does not work, or 
>>>> syntax error, or whatever). But I can not tell in this specific case if 
>>>> that is my problem. How can I further debug this annoying issue?
>>>>
>>>> Thanks,
>>>> Daniel
>>>>
>>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.

Reply via email to