I'm getting this error, I have been working to make it work but i can't. I followed the instructions on setting up the API_KEY value:

Traceback (most recent call last): File "tweets", line 25, in tweets = helpers.get_user_timeline(screen_name, 50) File "/home/ubuntu/workspace/pset6/sentiments/helpers.py", line 46, in get_user_timeline raise RuntimeError("API_KEY not set") RuntimeError: API_KEY not set

Here is my tweets code:

[code hidden]

  • 1
    Have you read the pset instructions carefully? There's a detailed set of instructions for setting your Twitter API Key.
    – Peter
    Commented Jun 14, 2017 at 2:18
  • 1
    Start here docs.cs50.net/problems/sentiments/…
    – Peter
    Commented Jun 14, 2017 at 2:26
  • 1
    What do you get when you execute in the command line the following: echo $API_KEY
    – ChrisG
    Commented Jul 9, 2017 at 15:07

1 Answer 1


Make sure you're running flask in the same terminal window in which you exported the keys.

  • How would one have figured this out? It seems like an obscure detail, hard to find online.
    – John Quinn
    Commented Nov 21, 2017 at 14:47
  • Hahahaha 😂 It was on a hunch that I tried it and it worked up which i then figured it made sense! Commented Nov 22, 2017 at 16:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .