TypeError: getattr(): attribute name must be string