minor issue here, but rather than doing this extra filesystem read operation, you could just catch an IOError on the iterparse() call.