I am trying to write a decorator in my python codes. When I compile it in the Jupyter notebook it runs fine but when I run the codes in the Spyder IDE, I get an error.
def search_func(sheetname):
def insider(f):
file = openpyxl.load_workbook("Excelfile.xlsx")
current_sheet = file[sheetname]
f(current_sheet)
return insider
@search_func('Passwords')
def Longin(current_sheet):
Name = User_name.get() + str(Password.get())
for i in range(1,current_sheet.max_row +1):
for j in range(1,current_sheet.max_column+1):
if current_sheet.cell(i,j).value == Name:
print("Hello")
The error, I get is "Longin() missing 1 required positional argument: 'current_sheet'"
Can anyone help me please?
Appreciate your time.
Cheers