[python-win32] Problems using ADSI from Python (need IDirectorySearch Interface)

Ulrich Eck ueck@net-labs.de
Mon, 22 Apr 2002 15:34:38 +0200


Hi win32 freaks,

I played around a lot with ADSI using python.

the standart method:
import win32com.client
NS = win32com.client.Dispatch('ADsNameSpaces')
ob = NS.GetObject('','LDAP://<myldapurl>')

works fine .. but I'ld like to use the static bindings
that i created with makepy.py (examing the activeds.dll (Active DS 
TypeLib)).

i used makepy-browser from pythonwin (as well as command-line)
to create a static-wrapper for the COM-Object and tried:

import ADSI
>>> ad = ADSI.IADs()
Traceback (most recent call last):
  File "<interactive input>", line 1, in ?
  File "P:\Python22\\lib\site-packages\win32com\client\__init__.py", line 
310, in __init__
    oobj = pythoncom.new(self.CLSID)
com_error: (-2147221164, 'Class not registered', None, None)
>>>

i'm working with ActivePython 2.2 on Win2000 (already has latest ADSI)

what am I doing wrong ??

another thing that makes me dizzy: the pythoncom reference (shipped with
active-python) tells about IADsUser,IADsContainer, IDirectoryObject in
chapter modules .. but i cannot import any of these ?!?

thanks for your help

Ulrich Eck
---------------------------------------------------------------------------
net-labs Systemhaus GmbH
Ebersberger Str. 46
85570 Markt Schwaben
fon:   +49-8121-4747-11
fax:   +49-8121-4747-77
email: ueck@net-labs.de
http://www.net-labs.de