Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not work when running code remotely #14

Open
BramVanroy opened this issue Aug 28, 2019 · 4 comments
Open

Does not work when running code remotely #14

BramVanroy opened this issue Aug 28, 2019 · 4 comments
Labels
help wanted Extra attention is needed

Comments

@BramVanroy
Copy link

I am running my code through SSH. My connecting device is a Windows 10 computer, and the machine actually doing the training is a linux server. When I use knockknock, though, I get the following trace.

Traceback (most recent call last):
  File "/home/bram/.local/share/virtualenvs/predicting-syntactic-equivalence-g0sIkWgJ/lib/python3.7/site-packages/secretstorage/util.py", line 47, in send_and_get_reply
    return self._connection.send_and_get_reply(msg)
  File "/home/bram/.local/share/virtualenvs/predicting-syntactic-equivalence-g0sIkWgJ/lib/python3.7/site-packages/jeepney/integrate/blocking.py", line 69, in send_and_get_reply
    return future.result()
  File "/home/bram/.local/share/virtualenvs/predicting-syntactic-equivalence-g0sIkWgJ/lib/python3.7/site-packages/jeepney/integrate/blocking.py", line 31, in result
    raise value
jeepney.wrappers.DBusErrorResponse: [org.freedesktop.DBus.Error.UnknownMethod] ("No such interface 'org.freedesktop.DBus.Properties' on object at path /org/freedesktop/secrets/collection/login",)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/bram/.local/share/virtualenvs/predicting-syntactic-equivalence-g0sIkWgJ/lib/python3.7/site-packages/secretstorage/collection.py", line 161, in get_default_collection
    return Collection(connection)
  File "/home/bram/.local/share/virtualenvs/predicting-syntactic-equivalence-g0sIkWgJ/lib/python3.7/site-packages/secretstorage/collection.py", line 44, in __init__
    self._collection.get_property('Label')
  File "/home/bram/.local/share/virtualenvs/predicting-syntactic-equivalence-g0sIkWgJ/lib/python3.7/site-packages/secretstorage/util.py", line 65, in get_property
    (signature, value), = self.send_and_get_reply(msg)
  File "/home/bram/.local/share/virtualenvs/predicting-syntactic-equivalence-g0sIkWgJ/lib/python3.7/site-packages/secretstorage/util.py", line 50, in send_and_get_reply
    raise ItemNotFoundException('Item does not exist!') from resp
secretstorage.exceptions.ItemNotFoundException: Item does not exist!

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/bram/.local/share/virtualenvs/predicting-syntactic-equivalence-g0sIkWgJ/lib/python3.7/site-packages/keyring/backends/SecretService.py", line 55, in get_preferred_collection
    collection = secretstorage.get_default_collection(bus)
  File "/home/bram/.local/share/virtualenvs/predicting-syntactic-equivalence-g0sIkWgJ/lib/python3.7/site-packages/secretstorage/collection.py", line 164, in get_default_collection
    'default', session)
  File "/home/bram/.local/share/virtualenvs/predicting-syntactic-equivalence-g0sIkWgJ/lib/python3.7/site-packages/secretstorage/collection.py", line 145, in create_collection
    raise PromptDismissedException('Prompt dismissed.')
secretstorage.exceptions.PromptDismissedException: Prompt dismissed.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "ml_s2v.py", line 173, in <module>
    trainer.train_model(options)
  File "/home/bram/.local/share/virtualenvs/predicting-syntactic-equivalence-g0sIkWgJ/lib/python3.7/site-packages/knockknock/email_sender.py", line 50, in wrapper_sender
    yag_sender.send(recipient_email, 'Training has started 🎬', contents)
  File "/home/bram/.local/share/virtualenvs/predicting-syntactic-equivalence-g0sIkWgJ/lib/python3.7/site-packages/yagmail/sender.py", line 147, in send
    self.login()
  File "/home/bram/.local/share/virtualenvs/predicting-syntactic-equivalence-g0sIkWgJ/lib/python3.7/site-packages/yagmail/sender.py", line 246, in login
    self._login(self.credentials)
  File "/home/bram/.local/share/virtualenvs/predicting-syntactic-equivalence-g0sIkWgJ/lib/python3.7/site-packages/yagmail/sender.py", line 203, in _login
    password = self.handle_password(self.user, password)
  File "/home/bram/.local/share/virtualenvs/predicting-syntactic-equivalence-g0sIkWgJ/lib/python3.7/site-packages/yagmail/sender.py", line 209, in handle_password
    return handle_password(user, password)
  File "/home/bram/.local/share/virtualenvs/predicting-syntactic-equivalence-g0sIkWgJ/lib/python3.7/site-packages/yagmail/password.py", line 11, in handle_password
    password = keyring.get_password("yagmail", user)
  File "/home/bram/.local/share/virtualenvs/predicting-syntactic-equivalence-g0sIkWgJ/lib/python3.7/site-packages/keyring/core.py", line 55, in get_password
    return _keyring_backend.get_password(service_name, username)
  File "/home/bram/.local/share/virtualenvs/predicting-syntactic-equivalence-g0sIkWgJ/lib/python3.7/site-packages/keyring/backends/SecretService.py", line 67, in get_password
    collection = self.get_preferred_collection()
  File "/home/bram/.local/share/virtualenvs/predicting-syntactic-equivalence-g0sIkWgJ/lib/python3.7/site-packages/keyring/backends/SecretService.py", line 57, in get_preferred_collection
    raise InitError("Failed to create the collection: %s." % e)
keyring.errors.InitError: Failed to create the collection: Prompt dismissed..

It states "Item does not exist" but I'm not sure which item it's referring to. This happens as soon as I launch the code, so I haven't been prompted for a password. In fact, it seems that the prompt is where things go wrong.

@VictorSanh
Copy link
Member

Hmm that's strange indeed. I am solely working on instances on the cloud and have never encountered this problem.
It seems the bug stems from yagmail, and more specifically when it calls keyring (the password manager). I have to look at it more precisely...

@VictorSanh VictorSanh added the help wanted Extra attention is needed label Aug 30, 2019
@BramVanroy
Copy link
Author

Hmm that's strange indeed. I am solely working on instances on the cloud and have never encountered this problem.
It seems the bug stems from yagmail, and more specifically when it calls keyring (the password manager). I have to look at it more precisely...

If it matters, I am using Ubuntu 18.04.2 LTS x86_64.

@rameshjes
Copy link

Hello @VictorSanh I am also facing same issue. I am running code in cluster with OS Ubuntu 16.04.6 LTS (GNU/Linux 4.4.0-161-generic x86_64) :

from knockknock import email_sender

@email_sender(recipient_emails=["abc@gmail.com"], sender_email="def@gmail.com")
def train_your_nicest_model():
    import time
    time.sleep(300)
    return {'loss': 0.9} # Optional return value

train_your_nicest_model()

I am getting following error:

Traceback (most recent call last):
  File "knockknock_example.py", line 9, in <module>
    train_your_nicest_model()
  File "/home/ramesh/.virtualenvs/code_of_conduct_env/lib/python3.6/site-packages/knockknock/email_sender.py", line 53, in wrapper_sender
    yag_sender.send(current_recipient, 'Training has started 🎬', contents)
  File "/home/ramesh/.virtualenvs/code_of_conduct_env/lib/python3.6/site-packages/yagmail/sender.py", line 147, in send
    self.login()
  File "/home/ramesh/.virtualenvs/code_of_conduct_env/lib/python3.6/site-packages/yagmail/sender.py", line 246, in login
    self._login(self.credentials)
  File "/home/ramesh/.virtualenvs/code_of_conduct_env/lib/python3.6/site-packages/yagmail/sender.py", line 192, in _login
    self.smtp = self.connection(self.host, self.port, **self.kwargs)
  File "/usr/lib/python3.6/smtplib.py", line 1031, in __init__
    source_address)
  File "/usr/lib/python3.6/smtplib.py", line 251, in __init__
    (code, msg) = self.connect(host, port)
  File "/usr/lib/python3.6/smtplib.py", line 336, in connect
    self.sock = self._get_socket(host, port, self.timeout)
  File "/usr/lib/python3.6/smtplib.py", line 1037, in _get_socket
    self.source_address)
  File "/usr/lib/python3.6/socket.py", line 724, in create_connection
    raise err
  File "/usr/lib/python3.6/socket.py", line 713, in create_connection
    sock.connect(sa)
OSError: [Errno 101] Network is unreachable

@VictorSanh
Copy link
Member

Hello @VictorSanh I am also facing same issue. I am running code in cluster with OS Ubuntu 16.04.6 LTS (GNU/Linux 4.4.0-161-generic x86_64) :

from knockknock import email_sender

@email_sender(recipient_emails=["abc@gmail.com"], sender_email="def@gmail.com")
def train_your_nicest_model():
    import time
    time.sleep(300)
    return {'loss': 0.9} # Optional return value

train_your_nicest_model()

I am getting following error:

Traceback (most recent call last):
  File "knockknock_example.py", line 9, in <module>
    train_your_nicest_model()
  File "/home/ramesh/.virtualenvs/code_of_conduct_env/lib/python3.6/site-packages/knockknock/email_sender.py", line 53, in wrapper_sender
    yag_sender.send(current_recipient, 'Training has started 🎬', contents)
  File "/home/ramesh/.virtualenvs/code_of_conduct_env/lib/python3.6/site-packages/yagmail/sender.py", line 147, in send
    self.login()
  File "/home/ramesh/.virtualenvs/code_of_conduct_env/lib/python3.6/site-packages/yagmail/sender.py", line 246, in login
    self._login(self.credentials)
  File "/home/ramesh/.virtualenvs/code_of_conduct_env/lib/python3.6/site-packages/yagmail/sender.py", line 192, in _login
    self.smtp = self.connection(self.host, self.port, **self.kwargs)
  File "/usr/lib/python3.6/smtplib.py", line 1031, in __init__
    source_address)
  File "/usr/lib/python3.6/smtplib.py", line 251, in __init__
    (code, msg) = self.connect(host, port)
  File "/usr/lib/python3.6/smtplib.py", line 336, in connect
    self.sock = self._get_socket(host, port, self.timeout)
  File "/usr/lib/python3.6/smtplib.py", line 1037, in _get_socket
    self.source_address)
  File "/usr/lib/python3.6/socket.py", line 724, in create_connection
    raise err
  File "/usr/lib/python3.6/socket.py", line 713, in create_connection
    sock.connect(sa)
OSError: [Errno 101] Network is unreachable

@rameshjesswani, are you sure it's the same error? It looks like it's something different causing your error... Did you make sure you gave yagmail access to the email you're using? (see here).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants