Closed the-machine-preacher closed 5 years ago
The bot apparently can not find your mybot plugin. Assuming mybot.py
is in the same folder than run.py
change the entry in PLUGINS
to 'mybot'
. Then it should work.
Full example of slackbot_settings.py
:
DEFAULT_REPLY = "Sorry but I didn't understand you"
PLUGINS = [
'mybot'
]
Worked! Thanks!
Happy to help. Please also mark this as solution to your related question on StackOverflow: https://stackoverflow.com/questions/56797185/how-to-initialize-python-slackbot-module
Hi,
I'm new to Slack bots (familiar with Discord.py). Followed your example, installed the package using
pip install slackbot
, went to the path of the installation, created aslackbot_settings.py
(with specified tags you mentioned) andrun.py
in the main directory andmybot.py
(with example commands you showed on your page), but I can't initialize the bot. I tried to run the bot usingpython run.py
but get the following error:Traceback (most recent call last): File "run.py", line 23, in
main()
File "run.py", line 20, in main
bot.run()
File "/Users/xxx/anaconda3/lib/python3.5/site-packages/slackbot/bot.py", line 32, in run
self._plugins.init_plugins()
File "/Users/xxx/anaconda3/lib/python3.5/site-packages/slackbot/manager.py", line 31, in init_plugins
self._load_plugins(plugin)
File "/Users/xxx/anaconda3/lib/python3.5/site-packages/slackbot/manager.py", line 47, in _load_plugins
path_name = importlib_find(plugin)
File "/Users/xxx/anaconda3/lib/python3.5/importlib/util.py", line 89, in find_spec
return _find_spec(fullname, parent.path)
AttributeError: module 'mybot' has no attribute 'path'
mybot.py has the following lines:
Where am I going wrong?