[Tutor] no attribute

Bryan Fodness bryan.fodness at gmail.com
Thu Dec 11 22:34:30 CET 2008


I am trying to change values in a file.  The following code does not seem to
find the attribute.

def anonymize(obj, attr):
    try:
        obj.attr = 'Anonymize'
    except AttributeError:
        pass

for fname in os.listdir(os.curdir):
    plan=ReadFile(fname)
    anonymize(plan, 'Name')

It seems to be the obj.attr in the function.  Can someone explain what I am
doing wrong?

Bryan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20081211/d34554aa/attachment.htm>


More information about the Tutor mailing list