title: Gmail login error with the help of imaplib in Python
body: <p>I am trying to use imaplib in order to fetch my mails</p>
  <pre><code>import imaplib
  mail= imaplib.IMAP4_SSL(&quot;imap.gmail.com&quot;)
  mail.login(&quot;mymailaddress&quot;,&quot;mypassword&quot;)
  mail.select(&quot;inbox&quot;)
  </code></pre>
  <p>but unfortunately, I am getting the following error</p>
  <pre><code> File , line 3, in &lt;module&gt;
      mail.login(&quot;mymailaddress&quot;,&quot;mypassword&quot;)
      raise self.error(dat[-1])
  imaplib.error: b'[ALERT] Application-specific password required: https://support.google.com/accounts/answer/185833 (Failure)'
  </code></pre>
  <p>I have checked all other suggestion given on similar question but none are working (<a href="https://stackoverflow.com/questions/25413301/gmail-login-failure-using-python-and-imaplib">similar problem</a>). I even enabled IMAP on my account. I also allow less secure app. What might be the reason for this error?</p>