TypeError - decode() argument 'encoding' must be str, not None
See original GitHub issueIt seems slack just had a blip and returned some kind of error responses that did not feature the charset header. This broke in the SDK with:
TypeError - decode() argument 'encoding' must be str, not None
On this line:
From the Sentry local-caputring I can see charset
was None
- in typing terms it’s Optional[str]
being used as a str
.
Reproducible in:
Requires slack returning these unexpected responses, or simulating them
The Slack SDK version
2.9.1
Python runtime version
3.8.5
OS info
Linux
Steps to reproduce:
As above
Expected result:
Some kind of fallback decoding?
Actual result:
TypeError
raised
Requirements
For general questions/issues about Slack API platform or its server-side, could you submit questions at https://my.slack.com/help/requests/new instead. 🙇
Please read the Contributing guidelines and Code of Conduct before creating this issue or pull request. By submitting, you are agreeing to those rules.
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
TypeError: decode() argument 1 must be str, not None
The Facebook response doesn't include a charset parameter indicating the encoding used: >>> from urllib import request >>> adress ...
Read more >TypeError: write() argument must be str, not None (Python)
The Python "TypeError: write() argument must be str, not None" occurs when we pass a None value to the write() method. To solve...
Read more >rpl error "TypeError: encode() argument 1 must be str, not None"
locale library isn't able to find the default locale and hence failing. The issue can be fixed by setting the LANG environment variable...
Read more >TypeError: decode() argument 1 must be string, not None
When I'm trying to connect to raspberry pi's kodi app trough dlna/upnp I get always this exception. $ pulseaudio-dlna 04-07 17:54:55 ...
Read more >TypeError: decode() argument 1 must be string, not MagicMock
1: File "/usr/lib64/python2.7/logging/__init__.py", line 860, in emit 1: ufs = fs.decode(stream.encoding) 1: TypeError: decode() argument 1 ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Btw it looks like the “happy path” would also have this problem, since it has identical lines for handling the charset + body:
https://github.com/slackapi/python-slackclient/blob/5a2c80eb78fa82c2805251a60bc3e0eccb0b1269/slack/web/base_client.py#L478-L479
We were trying to message Slack from deployment scripts, which use stackprint. and end of that traceback follows: