python3-ldap -> ldap3 (https://pypi.python.org/pypi/python3-ldap/0.9.8.4/)
is not the same thing as python-ldap...

It seems that python-ldap support python 3 :

https://github.com/python-ldap/python-ldap

Saddly enough, I hadn't successfully install python-ldap under python3 with
pip3... It fails over importing setuptools issue... Setuptools is
installed, so I wonder what going on...

It seems to be working with python 3.4+ :
https://www.python-ldap.org/en/latest/installing.html#build-prerequisites

If you have ubuntu you can try on your side :

sudo pip3 install -U setuptools
sudo pip3 install python-ldap


It would be nice if python-ldap just works under python3 as we wouldn't
have to touch ldap_auth.py as python-ldap should have keep the same API
under python3...

Though ldap3 seems to offer interresting progres, but I didn't try it.

Please keep posting here your progress.

Thanks

Richard



On Tue, Mar 13, 2018 at 8:32 AM, Johann Spies <johann.sp...@gmail.com>
wrote:

> Version 2.16.1
>
> In python (2.7) I can do:
>
> python web2py.py -S welcome
> ..
>
> In [1]: from gluon.contrib.login_methods.ldap_auth import ldap_auth
>
> In [2]:
>
> But not when I use python3 (and I have python3-ldap installed).
>
>
> ```
> /home/js/web2py/gluon/custom_import.py in custom_importer(name,
> globals, locals, fromlist, level)
>     109                 import_tb = None
>     110
> --> 111     return NATIVE_IMPORTER(name, globals, locals, fromlist, level)
>     112
>     113
>
> /home/js/web2py/gluon/contrib/login_methods/ldap_auth.py in <module>()
>      12 except Exception as e:
>      13     logging.error('missing ldap, try "easy_install python-ldap"')
> ---> 14     raise e
>      15
>      16
>
> /home/js/web2py/gluon/contrib/login_methods/ldap_auth.py in <module>()
>       7 import logging
>       8 try:
> ----> 9     import ldap
>      10     import ldap.filter
>      11     ldap.set_option(ldap.OPT_REFERRALS, 0)
>
> /home/js/web2py/gluon/custom_import.py in custom_importer(name,
> globals, locals, fromlist, level)
>     102                 return NATIVE_IMPORTER(name, globals, locals,
> fromlist, level)
>     103             except (ImportError, KeyError) as e3:
> --> 104                 raise ImportError(e1, import_tb)  # there an
> import error in the module
>     105         except Exception as e2:
>     106             raise  # there is an error in the module
>
> ImportError: (ImportError("Cannot import module
> 'applications.welcome.modules.ldap'",), <traceback object at
> 0x7fe54161fd88>)
>
> ```
>
> It seems to me like a bug?
>
> Regards
> Johann
>
> --
> Because experiencing your loyal love is better than life itself,
> my lips will praise you.  (Psalm 63:3)
>
> --
> 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 web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to