> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of jeff
> 
> Hi,

Hey Jeff,
 
> I'm trying to print out all the attributes of a user account in active
> directory. I got a script from:
> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/303348
> /index_txt

Hhhmm... I have some code that does basically the same thing, sans the
printing.  Mine looks up the user based on the sAMAccountName instead of
the distinguishedName, though.

> Now I'd like it to print pretty.

[SNIP function]

> user='LDAP://cn=Wardlaw\, Jeff,OU=IS Department,OU=IT
> department,DC=acpdom,DC=acp,DC=edu'
> for k, v in ad_dict(user):
>     print "%s=%s" % (k, v)
> 
> I get the following error when I try this:
> 
> D:\Python24>ad-attr.py
> Traceback (most recent call last):
>   File "D:\Python24\ad-attr.py", line 32, in ?
>     for k, v in ad_dict(user):
> ValueError: too many values to unpack

Try this instead ... I think it should help:

<code>

for k,v in ad_dict(user).items():

</code>

HTH,

Christian
http://www.dowski.com
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to