前提・実現したいこと
Herokuでpythonで開発したSlackBotを動かしたいと思っていて、herokuで
「heroku ps:scale worker=1」
とコマンドをうち、Botを起動させたのですが、数秒後に
「=== worker (Free): python3 run.py (1)
worker.1: crashed 2018/11/15 01:41:29 +0900 (~ 19s ago)」
表示されてBotが停止してしまいます.
発生している問題・エラーメッセージ
2018-11-14T16:41:28.999301+00:00 app[worker.1]: AttributeError: module 'slackbot.sett ings' has no attribute 'API_TOKEN'
該当のソースコード
Python
1# run.py 2# coding: utf-8 3 4from slackbot.bot import Bot 5 6def main(): 7 bot = Bot() 8 bot.run() 9 10if __name__ == "__main__": 11 print('start cocoa_bot') 12 main() 13
Python
1# slackbot_settings.py 2# coding: utf-8 3 4import config 5 6# botアカウントのトークンを指定 7API_TOKEN = config.TOKEN 8 9# このbot宛のメッセージで、どの応答にも当てはまらない場合の応答文字列 10DEFAULT_REPLY = "どうしたの?" 11 12# プラグインスクリプトを置いてあるサブディレクトリ名のリスト 13PLUGINS = ['plugins']
Python
1# config.py 2TOKEN = 'xoxb-xxxxxxxxxxxx-xxxxxxxxxxxx-xxxxxxxxxxxxxxx' 3CHANNEL = 'xxxxxxxxx'
試したこと
config.TOKEN
のところを’xoxb-xxxxxxxxxxxx-xxxxxxxxxxxx-xxxxxxxxxxxxxxx’
(SlackAPIのアクセストークン)に置き換えてみたが、解決せず...
補足情報(FW/ツールのバージョンなど)
macでやっています.
python:3.6.6
slackbot:0.5.1
ローカルで実行した時は普通に動きました.
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/11/19 04:05
2018/11/19 07:04