Comments (6)
Thanks for reporting, and sorry you're hitting a bug.
The usual cause of this problem is that you've set the environment variable but not exported it. For example:
$ SLACK_TOKEN=<my_token>
$ bin/limbo
2015-02-24 09:39:46,979:DEBUG:config: {'loglevel': 'DEBUG'}
<... logging omitted ...>
Traceback (most recent call last):
File "bin/limbo", line 17, in <module>
main(args)
File "/Users/llimllib/.virtualenvs/limbo/lib/python2.7/site-packages/limbo-3.0.0a1-py2.7.egg/limbo/limbo.py", line 165, in main
server = init_server(args)
File "/Users/llimllib/.virtualenvs/limbo/lib/python2.7/site-packages/limbo-3.0.0a1-py2.7.egg/limbo/limbo.py", line 154, in init_server
slack = Client(config["token"])
KeyError: 'token'
But after;
$ export SLACK_TOKEN=<my_token>
bin/limbo
works correctly. Are you certain that the variable is being exported? Can you paste the log output of bin/limbo
, which should show the configuration it finds?
from limbo.
I added an error message to the code that prints a more informative error in this case.
from limbo.
Its strange, I only get the error while running sudo make run
Python isn't seeing any env variables while run as sudo?
The env variable is saved in ~/.bashrc and the machine has been rebooted even.
Running
export SLACK_TOKEN=MYREALAPITOKEN
before sudo make run doesn't help either.
Using /usr/local/lib/python2.7/dist-packages
Searching for six==1.8.0
Best match: six 1.8.0
Adding six 1.8.0 to easy-install.pth file
Using /usr/local/lib/python2.7/dist-packages
Finished processing dependencies for limbo==3.0.0a2
make clean
make[1]: Entering directory `/home/ubuntu/slask'
rm -rf build dist limbo.egg-info
make[1]: Leaving directory `/home/ubuntu/slask'
bin/limbo
2015-02-24 17:10:39,394:ERROR:Unable to find a slack token. The environment variables
limbo sees are:
{}
and the current config is:
{}
Try setting your bot's slack token with:
export SLACK_TOKEN=<your-slack-bot-token>
Traceback (most recent call last):
File "bin/limbo", line 17, in <module>
main(args)
File "/usr/local/lib/python2.7/dist-packages/limbo-3.0.0a2-py2.7.egg/limbo/limbo.py", line 184, in main
server = init_server(args)
File "/usr/local/lib/python2.7/dist-packages/limbo-3.0.0a2-py2.7.egg/limbo/limbo.py", line 160, in init_server
slack = Client(config["token"])
KeyError: 'token'
make: *** [run] Error 1
If I run bin/slasklimbo it runs fine and I have no errors
from limbo.
When you run sudo, you're actually starting another shell as root, which means that it comes with a whole new set of environment variables, which doesn't include the ones in your user environment. That's why limbo can't find them.
I recommend that you either avoid running limbo as root or figure out how to set the environment variables such that the process will have access to them.
For example, I use an upstart script to start my instance of limbo, it looks like:
start on net-device-up
respawn
respawn limit 3 30
env SLACK_TOKEN=xoxb-<rest of token>
env LIMBO_LOGLEVEL=INFO
env LIMBO_LOGFILE=/var/log/limbo
exec /srv/limbo/bin/limbo
from limbo.
Marking as closed, but feel free to keep asking for help, and thanks again for reporting!
from limbo.
Thanks, I'll steal use your upstart script.
from limbo.
Related Issues (20)
- cloudwatch/pagerduty API integration HOT 1
- limbo handles slackbot reminders twice HOT 6
- Proposition: Drop support for Python 2 HOT 10
- Please set the OXFORD_APP_ID and OXFORD_APP_KEY environment variables to valid (free) Oxford dictionary API keys HOT 1
- Oxford V1 API is deprecated.
- slackclient not compatible with files.upload HOT 1
- Remove DarkSky dependency in Weather Plugin HOT 4
- Migrate away from deprecated API calls HOT 2
- upload packages with twine
- Make it easy to thread limbo responses HOT 2
- Travis is now unusably slow HOT 1
- plugin idea: emoji added/changed bot HOT 1
- convert to github actions
- add --version flag
- !cat
- !turtle
- !bunny
- Lunch status updater
- unsplash plugin
- use socket mode instead of rtm
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from limbo.