<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:arial,helvetica,sans-serif;font-size:10pt"><div>I am using the module <span style="font-family: Courier New,courier,monaco,monospace,sans-serif;">active_directory </span>and have an ad object called myuser.<br><br>I would like to run a series of statements like:<br><br><span style="font-family: Courier New,courier,monaco,monospace,sans-serif;">myuser.attribute</span><br><br>where attribute is a string variable, but python says that this is not the correct syntax.<br><br>error:<br><span style="font-family: Courier New,courier,monaco,monospace,sans-serif;"><span style="color: rgb(255, 127, 0);">for </span>x <span style="color: rgb(255, 127, 0);">in </span>myuser.properties: # "myuser.properties" returns a tuple of properties associated with the myuser AD object</span><br style="font-family: Courier
New,courier,monaco,monospace,sans-serif;"><span style="font-family: Courier New,courier,monaco,monospace,sans-serif;"> <span style="color: rgb(128, 0, 255);">print </span>myuser.x</span><br style="font-family: Courier New,courier,monaco,monospace,sans-serif;"><br style="font-family: Courier New,courier,monaco,monospace,sans-serif;"><span style="font-family: Courier New,courier,monaco,monospace,sans-serif; color: rgb(255, 0, 0);">Traceback (most recent call last):</span><br style="font-family: Courier New,courier,monaco,monospace,sans-serif; color: rgb(255, 0, 0);"><span style="font-family: Courier New,courier,monaco,monospace,sans-serif; color: rgb(255, 0, 0);"> File "<pyshell#148>", line 2, in <module></span><br style="font-family: Courier New,courier,monaco,monospace,sans-serif; color: rgb(255, 0, 0);"><span style="font-family: Courier New,courier,monaco,monospace,sans-serif; color: rgb(255, 0,
0);"> print myuser.x</span><br style="font-family: Courier New,courier,monaco,monospace,sans-serif; color: rgb(255, 0, 0);"><span style="font-family: Courier New,courier,monaco,monospace,sans-serif; color: rgb(255, 0, 0);"> File "build\bdist.win32\egg\active_directory.py", line 421, in __getattr__</span><br style="font-family: Courier New,courier,monaco,monospace,sans-serif; color: rgb(255, 0, 0);"><span style="font-family: Courier New,courier,monaco,monospace,sans-serif; color: rgb(255, 0, 0);"> raise AttributeError</span><br style="font-family: Courier New,courier,monaco,monospace,sans-serif; color: rgb(255, 0, 0);"><span style="font-family: Courier New,courier,monaco,monospace,sans-serif; color: rgb(255, 0, 0);">AttributeError</span><br><br><span style="color: rgb(0, 0, 0);"><br>example:<br><span style="font-family: Courier New,courier,monaco,monospace,sans-serif;">>>> myuser.properties[0] #first
value in user tuple</span><br style="font-family: Courier New,courier,monaco,monospace,sans-serif;"><span style="font-family: Courier New,courier,monaco,monospace,sans-serif; color: rgb(0, 0, 255);">u'cn'</span><br style="font-family: Courier New,courier,monaco,monospace,sans-serif;"><span style="font-family: Courier New,courier,monaco,monospace,sans-serif;">>>> myuser.cn</span><br style="font-family: Courier New,courier,monaco,monospace,sans-serif;"><span style="font-family: Courier New,courier,monaco,monospace,sans-serif; color: rgb(0, 0, 255);">u'Joe Sixpack'<br><br></span><span style="font-weight: bold;">How can I iterate through all of the values of the properties tuple and get each value?</span><br></span></div></div><br>
</body></html>