Active Directory and ActivePython2.1

waldekO osuchw at ecn.ab.ca
Sat Nov 10 04:42:48 EST 2001


"alan runyan" <runyaga at thisbox.com> wrote in message news:<Dm1H7.22705$qb.972993 at typhoon.austin.rr.com>...
> I'm trying to use ldap search filters w/ Python against Active Directory and
> things are jiving.  I can get it to work w/ ASP no problem.  All help would
> be *greatly* appreciated.
> 
> my problemed Python Script
>     adsi = win32com.client.Dispatch('ADsNameSpaces')
>     ldap=adsi.getobject('', 'LDAP:')
>     ldapQuery='<LDAP://mydomain.net>;(objectClass=Person);ADsPath,cn;root'
>     myDSObject = ldap.OpenDSObject(ldapQuery,'username','password', 1)
> 
> I get:
> Traceback (most recent call last):
>   File "E:\Python21\Pythonwin\pywin\framework\scriptutils.py", line 301, in
> RunScript
>     exec codeObject in __main__.__dict__
>   File "E:\ZOPE\Extensions\adsi.py", line 37, in ?
>   File "<COMObject <unknown>>", line 2, in OpenDSObject
> com_error: (-2147352567, 'Exception occurred.', (0, 'Active Directory',
> 'Unspecified error\r\n', None, 0, -2147467259), None)
> 
> in VBScript/ASP
> 
>       Set conn = server.createobject("ADODB.Connection")
>       conn.Provider = "ADSDSOObject"
>       conn.Open "ADs Provider"
>       Set rs =
> conn.Execute("<LDAP://mydomain.net>;(objectClass=Person);ADsPath,objectClass
> ,cn;subtree")
> 
> am I doing some glaringly wrong?
> 
> any comments greatly appreciated
> ~runyaga

I do not know enough about adsi to be of real help here but why don't
you try to Dispatch "ADODB.Connection" in Python script the same way
you do it in VBS


waldekO



More information about the Python-list mailing list