Looking at the error message you received:
Code:
smtplib.SMTPAuthenticationError: (534, b'5.7.9 Application-specific password required. Learn more at\n5.7.9 https://support.google.com/mail/?p=InvalidSecondFactor m1sm17428938qtk.34 - gsmtp')
you have Gmail set to require 2FA for your computer. You should be able to create an application specific password for calibre. If you click on the link in the error message (
https://support.google.com/mail/?p=InvalidSecondFactor ), you will get some help.