There is two chances to define price as they are contained in two try/except blocks that pass on any exception.
try: price = self.driver.get_element_by_id("priceblock_ourprice").text except: pass try: price = self.driver.get_element_by_id("priceblock_dealprice").text except: passif both of these raise an exception price wont be defined.