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

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

Open
bhav09 opened this issue Jul 29, 2022 · 0 comments
Open

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

bhav09 opened this issue Jul 29, 2022 · 0 comments

Comments

@bhav09
Copy link

bhav09 commented Jul 29, 2022

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant