Closed jasedit closed 8 years ago
If I had to guess, this is a direct result of #564. Lets try and get this fixed for the upcoming 4.0 release too.
@jasedit could you by any chance do me a small favor and see if the PyPI release (3.2.3) has this issue as well?
@jasedit thanks to the brave soul testing master !
Using the 3.2.3 release fails to connect to Slack, which is what drove me to master in the first place. The error using the result from PyPi is:
14:06:54 ERROR errbot.backends.base Exception occurred in serve_once:
Traceback (most recent call last):
File "/Users/jpz/Projects/errbot2/lib/python3.5/site-packages/errbot/backends/base.py", line 620, in serve_forever
if self.serve_once():
File "/Users/jpz/Projects/errbot2/lib/python3.5/site-packages/errbot/backends/slack.py", line 214, in serve_once
self.auth = self.api_call("auth.test", raise_errors=False)
File "/Users/jpz/Projects/errbot2/lib/python3.5/site-packages/errbot/backends/slack.py", line 203, in api_call
response = json.loads(self.sc.server.api_call(method, **data).decode('utf-8'))
AttributeError: 'str' object has no attribute 'decode'
Using the 3.2.3 release fails to connect to Slack, which is what drove me to master in the first place.
Well that really sucks. :disappointed: I'm going to get this fixed for you ASAP!
I certainly don't understand the code fully to understand if this fix is correct, but the error in 3.2.3 is resolved if the .decode('utf-8')
is removed from line 203 of slack.py. I don't know if api_call
is expected to return a Unicode string instead of a plain string, or if there's something else going on, but that makes the connection succeed for me.
If preferred (and I'm not completely off in the weeds), I can submit a PR to the 3.2 branch for review with that fix. I don't know what the preferred process for such things is, so I'm happy to help or cheer as need be.
It was a little messier than that and we were dealing with two issues here.
First of all, the second issue you encountered, the one on 3.2.3:
14:06:54 ERROR errbot.backends.base Exception occurred in serve_once:
Traceback (most recent call last):
File "/Users/jpz/Projects/errbot2/lib/python3.5/site-packages/errbot/backends/base.py", line 620, in serve_forever
if self.serve_once():
File "/Users/jpz/Projects/errbot2/lib/python3.5/site-packages/errbot/backends/slack.py", line 214, in serve_once
self.auth = self.api_call("auth.test", raise_errors=False)
File "/Users/jpz/Projects/errbot2/lib/python3.5/site-packages/errbot/backends/slack.py", line 203, in api_call
response = json.loads(self.sc.server.api_call(method, **data).decode('utf-8'))
AttributeError: 'str' object has no attribute 'decode'
This was caused by Slackclient introducing a backward-incompatible change in their latest release (1.0.0). This is now fixed on master by 91e8c079db98245a2eeb2fd42117ab1250305a98 and backported to the 3.2 branch as well, just in case we end up making another 3.2.x release.
As a workaround for other people reading this bug and hitting the same issue, you can take a git checkout of either 3.2 or master branch or, alternatively, downgrade slackclient to 0.17.
As for the original issue you encountered, this has been fixed in fa6b9a4c03b48cf39a439165ca8b626a171b3b66. The callback_mention doesn't appear to be in 3.2 so people downgrading slackclient to 0.17 should have no issues with that release.
I can confirm that updating to include the fix in fa6b9a4 fixes operating my chatbot with the master release. I haven't tested the 3.2 branch on GitHub, but it sounds like a 4.0 release is in the pipeline. Thanks for the fast and detailed responses!
Using Python 3.5, and the latest errbot from master. When I send the command:
errbot reports the following error: