I am trying to automatically post some numbers to my slack channel via the slacker
package (version 0.8.6). Sometimes the number that needs to be printed is a 0
, but I've found that posting 0
or "0"
gives me an error...
from slacker import Slacker
API_TOKEN = XXXXXXXXXX # I load in my api token from an environment variable
slack = Slacker(API_TOKEN)
channel = '#test-channel'
message = "0"
slack.chat.post_message(channel, message, parse='full')
I get this error: slacker.Error: no_text
Is this a bug in my code, slacker
, or the Slack API itself?
Full stack trace:
Traceback (most recent call last):
File "field-utils/fieldutils/slack.py", line 56, in <module>
slack.chat.post_message(channel, message, parse='full')
File "/Users/pedro/tools/slack-bot/venv/lib/python2.7/site-packages/slacker/__init__.py", line 257, in post_message
'icon_emoji': icon_emoji
File "/Users/pedro/tools/slack-bot/venv/lib/python2.7/site-packages/slacker/__init__.py", line 69, in post
return self._request(requests.post, api, **kwargs)
File "/Users/pedro/tools/slack-bot/venv/lib/python2.7/site-packages/slacker/__init__.py", line 61, in _request
raise Error(response.error)
slacker.Error: no_text
I reproduced your problem. I'm looking at Slacker and it seems like the Slack API is returning the error with that message.
try: message = '0\n'
(It's a silly hack! But nothing else worked)
the Slack Desktop App seems to render it as if you'd sent 0