Git Product home page Git Product logo

Comments (6)

llimllib avatar llimllib commented on May 31, 2024

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.

llimllib avatar llimllib commented on May 31, 2024

I added an error message to the code that prints a more informative error in this case.

from limbo.

mrplow avatar mrplow commented on May 31, 2024

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.

llimllib avatar llimllib commented on May 31, 2024

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.

llimllib avatar llimllib commented on May 31, 2024

Marking as closed, but feel free to keep asking for help, and thanks again for reporting!

from limbo.

mrplow avatar mrplow commented on May 31, 2024

Thanks, I'll steal use your upstart script.

from limbo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.