Reputation: 33
I'm using Python3 on a remote machine running Ubuntu 20.10 to send some emails with yagmail. I'm able to send the emails just fine with an application-specific password, as long as the password is spelled out directly in my code. But when I try to register my email address and password with keyring, I just get an error.
I run the following:
import yagmail
yagmail.register('MY_EMAIL', 'MY_PASSWORD')
And I get:
Traceback (most recent call last):
File "yag.py", line 3, in <module>
yagmail.register('MY_EMAIL', 'MY_PASSWORD')
File "/usr/local/lib/python3.10/dist-packages/yagmail/password.py", line 37, in register
keyring.set_password("yagmail", username, password)
File "/usr/lib/python3/dist-packages/keyring/core.py", line 60, in set_password
get_keyring().set_password(service_name, username, password)
File "/usr/lib/python3/dist-packages/keyring/backends/chainer.py", line 58, in set_password
return keyring.set_password(service, username, password)
File "/usr/lib/python3/dist-packages/keyring/backends/SecretService.py", line 88, in set_password
collection = self.get_preferred_collection()
File "/usr/lib/python3/dist-packages/keyring/backends/SecretService.py", line 64, in get_preferred_collection
raise InitError("Failed to create the collection: %s." % e)
keyring.errors.InitError: Failed to create the collection: Prompt dismissed..
What am I doing wrong?
Upvotes: 1
Views: 197
Reputation: 738
I had the same problem and this new env variable resolved it in my case:
export PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring
Upvotes: 0