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