Python-slack-sdk: File with multi-byte characters in the filename can not be uploaded.

Created on 7 May 2020  ·  2Comments  ·  Source: slackapi/python-slack-sdk

Description

File with multi-byte characters in the filename can not be uploaded.

What type of issue is this? (place an x in one of the [ ])

  • [x] bug
  • [ ] enhancement (feature request)
  • [ ] question
  • [ ] documentation related
  • [ ] testing related
  • [ ] discussion

Requirements (place an x in each of the [ ])

  • [x] I've read and understood the Contributing guidelines and have done my best effort to follow them.
  • [x] I've read and agree to the Code of Conduct.
  • [x] I've searched for any related issues and avoided creating a duplicate issue.

Bug Report

Reproducible in:

slackclient version: 2.5.0

python version: 3.8.1

OS version(s): Xubuntu 18.04

Steps to reproduce:

  1. Run the following python code.
client = slack.WebClient(token=MY_TOKEN)
client.files_upload(channels="#random", file="あ.txt")

あ.txt exists in the current directory.

Expected result:

I expected that あ.txt is uploaded.

Actual result:

The following error occurred.

  File "/home/vagrant/.pyenv/versions/3.8.1/lib/python3.8/site-packages/slack/web/client.py", line 970, in files_upload
    return self.api_call("files.upload", files={"file": file}, data=kwargs)
  File "/home/vagrant/.pyenv/versions/3.8.1/lib/python3.8/site-packages/slack/web/base_client.py", line 171, in api_call
    return self._event_loop.run_until_complete(future)
  File "/home/vagrant/.pyenv/versions/3.8.1/lib/python3.8/asyncio/base_events.py", line 612, in run_until_complete
    return future.result()
  File "/home/vagrant/.pyenv/versions/3.8.1/lib/python3.8/site-packages/slack/web/base_client.py", line 207, in _send
    f = open(v.encode("ascii", "ignore"), "rb")
FileNotFoundError: [Errno 2] No such file or directory: b'/home/vagrant/Downloads/.txt'
2x bug web-client

All 2 comments

Thanks again! I'll check this later today.

👋 slackclient 2.6.0rc1 is out. The pre-release version contains fixes for your issue described here.
https://pypi.org/project/slackclient/2.6.0rc1/

One week later from now, we'll be releasing version 2.6.0 to PyPI.

If you have a chance, could you try the release candidate version out and let us know your feedback if you find something wrong with it? Thank you very much for being patient with this issue.

Was this page helpful?
0 / 5 - 0 ratings