Randomly getting Broken pipe error on upload on certain combinations of files and channels
See original GitHub issueReproducible in:
The Slack SDK version
sudo pip3 freeze | grep slack slackclient==2.9.3
Python runtime version
python --version Python 2.7.16
python3 --version Python 3.8.6
OS info
ProductName: Mac OS X ProductVersion: 10.15.7 BuildVersion: 19H2 usage: uname [-amnprsv]
Steps to reproduce:
Run the command: python3 /usr/local/lib/python3.8/site-packages/slack/slack_file_upload.py $SLACK_CHANNEL $TOKEN $PATH_TO_FILE
slack_file_upload.py file contents:
import os
import slack
import sys
def upload_file(
slack_channel,
slack_token,
filepath):
client = slack.WebClient(token=slack_token)
response = client.files_upload(file=filepath, channels=slack_channel)
assert response
upload_file(slack_channel=sys.argv[1], slack_token=sys.argv[2], filepath=sys.argv[3])
Expected result:
It should upload everytime with success as it was the last 2-3 weeks
Actual result:
Randomly I am getting this error on certain combination of files + channel (while on other channels the files are uploaded flawlessly), and when I try to upload to other channel the same file it works, then when getting back to the old channel sometimes it starts to work sometimes not.
Traceback (most recent call last):
File "/usr/local/Cellar/python@3.8/3.8.6/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 1350, in do_open
h.request(req.get_method(), req.selector, req.data, headers,
File "/usr/local/Cellar/python@3.8/3.8.6/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py", line 1255, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/usr/local/Cellar/python@3.8/3.8.6/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py", line 1301, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/usr/local/Cellar/python@3.8/3.8.6/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py", line 1250, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/usr/local/Cellar/python@3.8/3.8.6/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py", line 1049, in _send_output
self.send(chunk)
File "/usr/local/Cellar/python@3.8/3.8.6/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py", line 971, in send
self.sock.sendall(data)
File "/usr/local/Cellar/python@3.8/3.8.6/Frameworks/Python.framework/Versions/3.8/lib/python3.8/ssl.py", line 1204, in sendall
v = self.send(byte_view[count:])
File "/usr/local/Cellar/python@3.8/3.8.6/Frameworks/Python.framework/Versions/3.8/lib/python3.8/ssl.py", line 1173, in send
return self._sslobj.write(data)
BrokenPipeError: [Errno 32] Broken pipe
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/slack/slack_file_upload.py", line 15, in <module>
upload_file(slack_channel=sys.argv[1], slack_token=sys.argv[2], filepath=sys.argv[3])
File "/usr/local/lib/python3.8/site-packages/slack/slack_file_upload.py", line 11, in upload_file
response = client.files_upload(file=filepath, channels=slack_channel)
File "/usr/local/lib/python3.8/site-packages/slack/web/client.py", line 1533, in files_upload
return self.api_call("files.upload", files={"file": file}, data=kwargs)
File "/usr/local/lib/python3.8/site-packages/slack/web/base_client.py", line 150, in api_call
return self._sync_send(api_url=api_url, req_args=req_args)
File "/usr/local/lib/python3.8/site-packages/slack/web/base_client.py", line 241, in _sync_send
return self._urllib_api_call(
File "/usr/local/lib/python3.8/site-packages/slack/web/base_client.py", line 352, in _urllib_api_call
response = self._perform_urllib_http_request(url=url, args=request_args)
File "/usr/local/lib/python3.8/site-packages/slack/web/base_client.py", line 495, in _perform_urllib_http_request
raise err
File "/usr/local/lib/python3.8/site-packages/slack/web/base_client.py", line 475, in _perform_urllib_http_request
resp = urlopen( # skipcq: BAN-B310
File "/usr/local/Cellar/python@3.8/3.8.6/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 222, in urlopen
return opener.open(url, data, timeout)
File "/usr/local/Cellar/python@3.8/3.8.6/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 525, in open
response = self._open(req, data)
File "/usr/local/Cellar/python@3.8/3.8.6/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 542, in _open
result = self._call_chain(self.handle_open, protocol, protocol +
File "/usr/local/Cellar/python@3.8/3.8.6/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 502, in _call_chain
result = func(*args)
File "/usr/local/Cellar/python@3.8/3.8.6/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 1393, in https_open
return self.do_open(http.client.HTTPSConnection, req,
File "/usr/local/Cellar/python@3.8/3.8.6/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 1353, in do_open
raise URLError(err)
urllib.error.URLError: <urlopen error [Errno 32] Broken pipe>
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (4 by maintainers)
Yes thanks, you can close the issue.
Hi @NudeNULL ,
If you have any updates on your issue and can share your knowledge here, it would be greatly appreciated.
Also, if I understand correctly, this project maintainers don’t have any further action to take for this issue. If you don’t mind, let us close this issue.