Well, I have a problem, I get this error:
File "sss.py", line 24
if order not in self.products_exhausted:
^
IndentationError: unindent does not match any outer indentation level
I have tried everything and it does not work, I do not know why, the ID is 4 and it is correct, please help, this would be the code:
import pickle
class Provider():
def __init__(self, service):
self.service = service
self.products_exhausted = []
file = open("DataBase-ProductsExhausted", "ab+")
file.close()
def add_products_exhausted(self, product):
self.products_exhausted.append(product)
file = open("DataBase-ProductsExhausted", "wb")
file.dump(self.products_exhausted, file)
file.close()
def notification_receiver(self, order):
try:
file = open("DataBase-ProductsExhausted", "rb")
self.products_exhausted = pickle.load(file)
file.close()
#Aqui es el error
if order not in self.products_exhausted:
print("El pedido de: {}, esta agotado.".format(order))
else:
print("El pedido de: {}, se ha completado con exito!".format(order))
class System(Provider):
def __init__(self, service):
super().__init__(service)
self.database = []
file = open("DataBase", "ab+")
file.close()
def notifier(self, order):
super().notification_receiver(order)
def add_products(self, product):
self.database.append(product)
file = open("DataBase", "wb")
pickle.dump(self.database, file)
file.close()
def send_order(self, order):
try:
file = open("DataBase", "rb")
self.database = pickle.load(file)
file.close()
if self.service:
if order not in self.database:
print("El producto: {}, no esta disponible en este momento.".format(order))
else:
self.notifier(order)
else:
print("El sistema esta fuera de servicio.")
Help please !!