I'm trying to check if some xml in a django app has certain elements/nodes and if not just to skip that code block. I'm checking for the elements existance using hasattr(), which should return false if the element doesn't exist: 
if hasattr(product.ItemAttributes, 'ListPrice')  \ and hasattr(product.Offers.Offer.OfferListing, 'PercentageSaved') \
                            and hasattr(product.LargeImage, 'URL'):
Except in my case it's throwing an attribute error:
AttributeError at /update_products/
no such child: {http://webservices.amazon.com/AWSECommerceService/2011-08-01}LargeImage
I don't understand why it's throwing an error instead of just returning false and letting me skip the code block?
The error is complaining about LargeImage. That's being caused by this expression: product.LargeImage. You might want to check for that first, or even better, put this in a try/except block.
hasattr() throws AttributeError