Exception
PYL-E071222 return None
23 price1 = price(ref).split('/')
24 return price1[0], ref
25 except all as error:26 print(error)
27 print('Error on parcer_ozon')
28 return None
46 prices = prices.text.replace('\u2009', '').replace('\n', ' / ')
47 browser2.quit()
48 return prices
49 except all as error:50 print(error)
51 print('Error on price')
52 return None
37 else:
38 return None
39 return [ref, price]
40 except all as er: #Да не правильно, но что поделать, ловлю все ошибки41 print("Error on parseWB2")
42 print(er)
43 return None
For an exception to be caught, it must inherit from the Exception
class.
try:
if foo < 5:
print('foo is small')
except NotImplemented: # This is not an error class!
print('Some error occured')
try:
if foo < 5:
print('foo is small')
except NotImplementedError: # This is a valid error class
print('Some error occured')