0

I am trying to login to my Gmail with POP. I have enabled POP/IMAP on my Gmail privacy settings, as well as "Access for less secure apps". I always get the same error.

Traceback (most recent call last):
File "scan.py", line 10, in <module>
R.pass_(passw)
File"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/poplib.py", line 197, in pass_
return self._shortcmd('PASS %s' % pswd)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/poplib.py", line 160, in _shortcmd
return self._getresp()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/poplib.py", line 136, in _getresp
raise error_proto(resp)
poplib.error_proto: -ERR [AUTH] Username and password not accepted.

I do not know what I am doing wrong. This is my source code.

import getpass, poplib

success = False
user = raw_input('Username: ')
passw = getpass.getpass()
#passw = raw_input('Password: ')

R=poplib.POP3_SSL('pop.gmail.com',995)
R.user(user)
R.pass_(passw)
suky
  • 1
  • 1
  • IIRC, you need to put the port number in quotation marks, like this: `R = poplib.POP3_SSL('pop.gmail.com', '995')`. Also, `getpass` contains a method called `getpass.getuser()` which might solve the credentials problem. – Dartmouth Sep 10 '16 at 18:04
  • @Dartmouth I tried that, it still did not work. – suky Sep 10 '16 at 18:08
  • Have you tried to turn on debugging? `R.set_debuglevel(1)` – AnFi Sep 18 '16 at 19:42

0 Answers0