Problem:
For the following code I got some error message like:
ValueError: not enough values to unpack (expected 3, got 2)
The code:
import openpyxl, smtplib, sys
wbs = openpyxl.load_workbook('duesRecords.xlsx')
sheet = wb.get_sheet_by_name('Sheet1')
lastCol = sheet.max_column
latestMonth = sheet.cell(row=1, column=lastCol).value
unpaidMembers = {}
for r in range(2, sheet.max_row + 1):
payments = sheet.cell(row=r, column=lastCol).value
if payment != 'zaplacone':
name = sheet.cell(row=r, column=2).value
lastname = sheet.cell(row=r, column=3).value
email = sheet.cell(row=r, column=4).value
unpaidMembers[name] = email
smtpObj = smtplib.SMTP_SSL('lansfl.gmail.com', 465)
smtpObj.ehlo()
smtpObj.login('xyz@xyz.com', '1234')
for name, email in unpaidMembers.items()
body = "Subject: %s - przypomnienie o platnosci raty za treningi GIT Parkour. " \
"\n\nPrzypominamy o uregulowaniu wplaty za uczestnictwo: %s w treningach GIT Parkour w ." \
"\n\nRecords show that you have not paid dues for %s. Please make " \
"this payment as soon as possible."%(latestMonth, name, latestMonth)
print('Sending email to %s...' % email)
sendmailStatus = smtpObj.sendmail('abc@abc.com', email, body)
if sendmailStatus != {}:
print('There was a problem sending email to %s: %s' % (email,
sendmailStatus))
smtpObj.quit()
Can anyone help me out to solve this problem?