huggingface / huggingface/knockknock

ConnectionResetError: [Errno 54] Connection reset by peer

Open
#78 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
2.8k
Forks
223
PR merge metrics
No merged PRs in 30d

Description

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
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
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at the email_sender decorator entry point shown in knockknock/email_sender.py, especially wrapper_sender, and reproduce the SMTP connection with the reported Python and macOS environment. Inspect how the sender is configured before yagmail connects; done means identifying whether knockknock causes the reset and documenting or fixing a reproducible project-side cause.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.