noirello / bonsai

Simple Python 3 module for LDAP, using libldap2 and winldap C libraries.
MIT License
117 stars 33 forks source link

Unable to import os macOS 10.12.3 (Python 3.6) #9

Closed Gr1N closed 6 years ago

Gr1N commented 7 years ago

Hi,

Just tried to use library and got exception on import:

In [1]: import bonsai
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-1-52837d26041c> in <module>()
----> 1 import bonsai

/Users/ng/.virtualenvs/env/lib/python3.6/site-packages/bonsai/__init__.py in <module>()
      1 from .ldapdn import LDAPDN
      2 from .ldapurl import LDAPURL
----> 3 from .ldapconnection import LDAPConnection
      4 from .ldapconnection import LDAPSearchScope
      5 from .ldapentry import LDAPEntry

/Users/ng/.virtualenvs/env/lib/python3.6/site-packages/bonsai/ldapconnection.py in <module>()
      2 from typing import Union, Any, List, Iterator, Tuple
      3
----> 4 from ._bonsai import ldapconnection
      5 from .ldapdn import LDAPDN
      6 from .ldapentry import LDAPEntry

ImportError: dlopen(/Users/ng/.virtualenvs/env/lib/python3.6/site-packages/bonsai/_bonsai.cpython-36m-darwin.so, 2): Symbol not found: _ldap_create_passwordpolicy_control
  Referenced from: /Users/ng/.virtualenvs/env/lib/python3.6/site-packages/bonsai/_bonsai.cpython-36m-darwin.so
  Expected in: flat namespace
 in /Users/ng/.virtualenvs/env/lib/python3.6/site-packages/bonsai/_bonsai.cpython-36m-darwin.so

In [2]:

I use latest version of bonsai from PyPI and Python 3.6. Any ideas?

noirello commented 7 years ago

Hi,

Sorry, I made a mistake and published a wrong wheel package for Mac when I released the new version, so I had to removed it right after.

Now, only source distribution is available for Mac, which tend to use the old libldap library after install that hasn't got several necessary functions.

To solve your problem, you should remove the installed package first, then download and install this fixed wheel file. Also, there's a description about how to compile the module with newer libldap library in the docs.

This should fix the issue, but please, tell me if you run any other problem.

Gr1N commented 7 years ago

It works, thanks! Could you please upload updated wheel in PyPI?

noirello commented 7 years ago

I'm glad it works. Sadly, reuploading a same versioned distribution is not possible on PyPI, so I should have to increase version number, but if I would do that I would rather add some other features and fixes to a new 0.9.1 release.

I'm working on this new release, but I don't think that it's going to happen sooner than the end of the month.

Gr1N commented 7 years ago

I see, it's not a big problem because my production running on Linux. But don't close issue until release, your wheel in this issue can be useful for other people.

noirello commented 6 years ago

I've made a new realase, with working macOS wheel uploaded to PyPI.