huggingface / knockknock

🚪✊Knock Knock: Get notified when your training ends with only two additional lines of code
MIT License
2.78k stars 233 forks source link

ConnectionResetError: [Errno 54] Connection reset by peer #78

Open bhav09 opened 2 years ago

bhav09 commented 2 years ago

Hey, I have been trying to use the email functionality of knock-knock but I m facing this error. Could you please help me with this? Sharing the code and error below.

Thanks! Bhavishya

CODE

imports..

def train_model(X_train,y_train,X_test,y_test):
    classifier=SVC()
    classifier.fit(X_train,y_train)
    return f'Accuracy of the model: {(classifier.score(X_test, y_test))*100}%'

@email_sender(recipient_emails=["bhavishyapandit9@gmail.com"],sender_email="knockknocknotificationstest@gmail.com")
def train_model_email_notify(X_train, y_train, X_test, y_test):
    return train_model(X_train,
                       y_train,
                       X_test,
                       y_test)

wines=datasets.load_wine()
x = wines['data']
y = wines['target']

X_train, X_test, y_train, y_test = train_test_split(x,y,test_size=0.2)
mm = MinMaxScaler()
X_train=mm.fit_transform(X_train)
X_test=mm.fit_transform(X_test)
train_model_email_notify(X_train, y_train, X_test, y_test)

ERROR

Traceback (most recent call last):
  File "/Users/bhavishya.pandit/PycharmProjects/ProjectTesting/test.py", line 30, in <module>
    train_model_email_notify(X_train, y_train, X_test, y_test)
  File "/Library/Python/3.8/site-packages/knockknock/email_sender.py", line 53, in wrapper_sender
    yag_sender.send(current_recipient, 'Training has started 🎬', contents)
  File "/Library/Python/3.8/site-packages/yagmail/sender.py", line 156, in send
    self.login()
  File "/Library/Python/3.8/site-packages/yagmail/sender.py", line 210, in login
    self._login(self.credentials)
  File "/Library/Python/3.8/site-packages/yagmail/sender.py", line 217, in _login
    self.smtp = self.connection(self.host, self.port, **self.kwargs)
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/smtplib.py", line 1034, in __init__
    SMTP.__init__(self, host, port, local_hostname, timeout,
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/smtplib.py", line 253, in __init__
    (code, msg) = self.connect(host, port)
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/smtplib.py", line 339, in connect
    self.sock = self._get_socket(host, port, self.timeout)
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/smtplib.py", line 1042, in _get_socket
    new_socket = self.context.wrap_socket(new_socket,
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/ssl.py", line 500, in wrap_socket
    return self.sslsocket_class._create(
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/ssl.py", line 1040, in _create
    self.do_handshake()
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/ssl.py", line 1309, in do_handshake
    self._sslobj.do_handshake()
ConnectionResetError: [Errno 54] Connection reset by peer