MA3STR0 / kimsufi-crawler

Crawler that will send you an email alert as soon as servers on OVH/Kimsufi become available for purchase
MIT License
194 stars 62 forks source link

Error with gmail signon. #18

Closed ghost closed 9 years ago

ghost commented 9 years ago

Hi I get this error:

   2015-02-15 21:36:52,889 Cannot connect to your SMTP account. Correct your config and try again. Error details:
2015-02-15 21:36:52,917 'bytes' object has no attribute 'encode'
2015-02-15 21:36:52,927 Notifier loading failed,check configuration for errors
Traceback (most recent call last):
  File "crawler.py", line 124, in <module>
    notifier = getattr(n_module, n_classname)(config)
  File "/home/<user>/kimsufi-crawler/notifiers/email_notifier.py", line 26, in __init__
    super(EmailNotifier, self).__init__(config)
  File "/home/<user>/kimsufi-crawler/notifiers/base_notifier.py", line 12, in __init__
    self.check_requirements()
  File "/home/<user>/kimsufi-crawler/notifiers/email_notifier.py", line 37, in check_requirements
    server.login(self.fromuser, self.frompwd)
  File "/usr/lib/python3.4/smtplib.py", line 642, in login
    "%s %s" % (AUTH_LOGIN, encode_base64(user.encode('ascii'), eol='')))
AttributeError: 'bytes' object has no attribute 'encode'

However on checking config.json my details are correct:

{
    "servers": ["KS-1"],
    "zones": ["rbx", "sbg"],
    "notifier": "email",
    "use_starttls": true,
    "from_email": "<EMAIL>",
    "from_user": "<EMAIL>",
    "from_pwd": "<PASSWORD>",
    "from_smtp_host": "smtp.gmail.com",
    "from_smtp_port": 587,
    "to_email": "<SAME EMAIL>"
}

I also did this: https://support.google.com/accounts/answer/6010255

Any ideas?

MA3STR0 commented 9 years ago

You probably run it with Python 3. I plan to make it 3.4-compatible, but as a quick solution just try Python 2.x.

ghost commented 9 years ago

Hi, Thanks I got it working. I'll detail the steps.

I'm on archlinux on raspberry pi:

which python

then type for example me

/usr/bin/python , hit tab, again , then you should see python2.7

install from here https://pypi.python.org/pypi/tornado but replace python with /usr/bin/python2.7

you must do this step.

then run the script /usr/bin/python2.7 crawler.py

success!

MA3STR0 commented 9 years ago

Cool, thanks for your feedback!