私のldap3での最初の経験は計画どおりではありません。これが機能しない理由私は十分に簡単なようだhttp://ldap3.readthedocs.io/abstraction.htmlPython ldap3リーダーコールが失敗する
s = Server('server')
c = Connection(s, user = 'username', password = 'password')
query = 'Department: Accounting' # explained in next paragraph
person_reader = Reader(c, person, 'o=test', query)
person_reader.search()
から...
コード例を把握することはできません。しかし、ServerとConnectionの呼び出しでうまく動作する私のコードは、Reader呼び出しで塊を吹き飛ばします。ここでは、コードスニペットがあります:
condaリスト毎のquery = 'department: Security Risk'
person_reader = Reader(c, person, 'OU=All Businesses', query)
と非常に醜い結果
AttributeError Traceback (most recent call last)
in()
1 query = 'department: Security Risk'
----> 2 person_reader = Reader(c, person, 'OU=All Businesses', query)
C:\Users########\AppData\Local\Continuum\Anaconda3\lib\site-packages\ldap3\abstract\reader.py in init(self, connection, object_def, query, base, components_in_and, sub_tree, get_operational_attributes, controls)
79 self.base = base
80 self._components_in_and = components_in_and
---> 81 self.attributes = sorted([attr.name for attr in self._definition])
82 self.get_operational_attributes = get_operational_attributes
83 self.controls = controls
C:\Users##########\AppData\Local\Continuum\Anaconda3\lib\site-packages\ldap3\abstract\reader.py in (.0)
79 self.base = base
80 self._components_in_and = components_in_and
---> 81 self.attributes = sorted([attr.name for attr in self._definition])
82 self.get_operational_attributes = get_operational_attributes
83 self.controls = controls
AttributeError: 'str' object has no attribute 'name'
:
ldap3 1.0.4 py35_0`
私はここで何をしないのですか?
'person_reader.search()'を呼び出すまでになっていますか?コードサンプルにnoと表示されます。 –
参考:Anaconda Pythonバージョン3.5.2を使用しています – Harvey
また、「人」とは何ですか?それは未定義のようです。 –