You can try the following to reproduce:

easy_install -d ./web2py/site-packages sqlalchemy
to install the module in the web2py site-packages directory.

If you now run web2py (console):
python web2py.py -S welcome
import sqlalchemy

Without the patch it fails ImportError: No module named sqlalchemy
With the patch there is no problem.

Op vrijdag 29 juni 2012 12:59:39 UTC+2 schreef Niphlod het volgende:
>
> I could use some more explanation...... the site module is imported in the 
> interpreter anyway, staring at the docs.
>
> in the first post you say:
>
> Only it does not work with modules installed by python easy-install.
>>
>
> in this one
>
> Just installing with PIP or easy_install works
>>
>
> I'm surely missing something.
>
> Could you please explain what feature is currently missing in web2py (i.e. 
> what you tried to do and didn't work that with the submitted patch 
> works...)?
>  
>
> Il giorno venerdì 29 giugno 2012 10:33:07 UTC+2, Corne Dickens ha scritto:
>>
>> It depends on what you do..
>>
>> Just installing with PIP or easy_install works..
>> Installing in web2py/site_packages and before starting web2py add 
>> site_packages to the python path also works.
>>
>> But in web2py its self the site_packages is added to the path, but in 
>> that case installed packages are not (or not all of them) recognized.
>> Difference is that in case you put a module in site-packages yourself you 
>> get a directory 'yourmodule'
>> With easy_install / pip you get yourmodule.egg with yourmodule as a 
>> subdir.
>>
>>
>>
>> Op donderdag 28 juni 2012 16:55:35 UTC+2 schreef Niphlod het volgende:
>>>
>>> Ahem....
>>> If I install a module using easy_install web2py recognizes it 
>>> correctly........ (you should use pip, btw)
>>>
>>> Maybe you are running two different python version and the 
>>> easy_installed library is on one interpreter and you run web2py with 
>>> another interpreter......
>>>
>>> Web2py first looks into modules/ of the application folder, than into 
>>> site-packages/ of web2py folder and then in normal interpreter paths.
>>> so, if you can:
>>>
>>> >> python
>>> >> import this
>>>
>>> you can also
>>>
>>> >>python web2py.py
>>>
>>> and call "import this" in your apps.
>>>
>>>
>>> Il giorno giovedì 28 giugno 2012 16:27:58 UTC+2, Corne Dickens ha 
>>> scritto:
>>>>
>>>> Hi,
>>>>
>>>> Web2py imports modules from the site-packages directory which is a 
>>>> great way to build a project withoud any 'external' dependencies.
>>>> Only it does not work with modules installed by python easy-install.
>>>>
>>>> Python it's self uses a site module for this, which can be added to 
>>>> web2py in an easy way.
>>>> Maybe this is a nice addition for the next version?
>>>>
>>>> --- web2py/gluon/admin.py       2012-03-04 23:11:41.000000000 +0100
>>>> +++ ../web2py/gluon/admin.py    2012-03-08 12:19:52.000000000 +0100
>>>> @@ -7,6 +7,7 @@                                                    
>>>>  ===========================================                       
>>>>  """                                                               
>>>>  import os                                                         
>>>> +import site                                                       
>>>>  import sys                                                        
>>>>  import traceback                                                  
>>>>  import zipfile                                                    
>>>> @@ -430,6 +431,7 @@                                                
>>>>                                                                    
>>>>  def add_path_first(path):                                         
>>>>      sys.path = [path]+[p for p in sys.path if (not p==path and not 
>>>> p==(path+'/'))]
>>>> +    site.addsitedir(path)                                             
>>>>             
>>>>                                                                         
>>>>            
>>>>  def create_missing_folders():                                         
>>>>             
>>>>      if not global_settings.web2py_runtime_gae:                         
>>>>            
>>>>
>>>>
>>>>
>>>>

Reply via email to