kootenpv / yagmail

Send email in Python conveniently for gmail using yagmail
MIT License
2.66k stars 265 forks source link

python3.5 register error #107

Open Gseguelg opened 6 years ago

Gseguelg commented 6 years ago

I've installed yagmail with: pip3 install yagmail[all], also tried pip3 install yagmail and with sudo as well.

Now when I want to register and email inside an interactive python3 session via

>>> import yagmail
>>> yagmail.register('username', 'password')

I get the following error

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.5/dist-packages/yagmail/__main__.py", line 10, in register
    keyring.set_password('yagmail', username, password)
  File "/usr/local/lib/python3.5/dist-packages/keyring/core.py", line 47, in set_password
    _keyring_backend.set_password(service_name, username, password)
  File "/usr/local/lib/python3.5/dist-packages/keyring/backends/SecretService.py", line 85, in set_password
    collection.create_item(label, attributes, password, replace=True)
  File "/usr/local/lib/python3.5/dist-packages/secretstorage/collection.py", line 113, in create_item
    secret = format_secret(self.session, secret, content_type)
  File "/usr/local/lib/python3.5/dist-packages/secretstorage/util.py", line 102, in format_secret
    encrypted_secret = encryptor.update(secret) + encryptor.finalize()
  File "/usr/local/lib/python3.5/dist-packages/cryptography/hazmat/primitives/ciphers/base.py", line 149, in update
    return self._ctx.update(data)
  File "/usr/local/lib/python3.5/dist-packages/cryptography/hazmat/backends/openssl/ciphers.py", line 120, in update
    n = self.update_into(data, buf)
  File "/usr/local/lib/python3.5/dist-packages/cryptography/hazmat/backends/openssl/ciphers.py", line 131, in update_into
    "unsigned char *", self._backend._ffi.from_buffer(buf)
TypeError: from_buffer() cannot return the address of the raw string within a bytes or unicode or bytearray object

versions:

yagmail 0.10.212
pip3 9.0.1
Linux Mint 18

Any ideas?

Note: I've tried same thing (obviously with pip), on same machine with python2.7 and it works excellent.

kootenpv commented 6 years ago

I'm actually not sure. I have not been using the keyring in a long time anymore as it is not functioning so well as of late.

Instead, I'm using OAuth2. It's a bit more setup, but it is a lot safer (when someone does get local access to your machine, they won't immediately have full access to your email).