File "/usr/local/lib/python3.4/dist-packages/flask/app.py", line 2000, in __call__
return self.wsgi_app(environ, start_response)
File "/usr/local/lib/python3.4/dist-packages/flask/app.py", line 1991, in wsgi_app
response = self.make_response(self.handle_exception(e))
File "/usr/local/lib/python3.4/dist-packages/flask/app.py", line 1567, in handle_exception
reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python3.4/dist-packages/flask/_compat.py", line 33, in reraise
raise value
File "/usr/local/lib/python3.4/dist-packages/flask/app.py", line 1988, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python3.4/dist-packages/flask/app.py", line 1641, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/local/lib/python3.4/dist-packages/flask/app.py", line 1544, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python3.4/dist-packages/flask/_compat.py", line 33, in reraise
raise value
File "/usr/local/lib/python3.4/dist-packages/flask/app.py", line 1639, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python3.4/dist-packages/flask/app.py", line 1625, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/home/ubuntu/workspace/pset6/sentiments/application.py", line 21, in search
tweets = helpers.get_user_timeline(screen_name)
File "/home/ubuntu/workspace/pset6/sentiments/helpers.py", line 62, in get_user_timeline
raise RuntimeError("invalid API_KEY and/or API_SECRET") from None
RuntimeError: invalid API_KEY and/or API_SECRET

The debugger caught an exception in your WSGI application. You can now look at the traceback which led to the error. To switch between the interactive traceback and the plaintext one, you can click on the "Traceback" headline. From the text traceback you can also create a paste of it. For code execution mouse-over the frame you want to debug and click on the console icon on the right side.

You can execute arbitrary Python code in the stack frames and there are some extra helpers available for introspection:

dump() shows all variables in the frame dump(obj) dumps all that's known about the object

  • For future reference, select all the code/errors and then click {} to properly format it. Question - did you go to apps.twitter.com, copy the API_KEY and API_SECRET, and export API_KEY=[value] and export API_SECRET=[value]? – SuperNovaCoder Apr 11 '17 at 22:10
  • SuperNovaCoder, yes, I did all that. The only thing is I couldn't use harvard url, as the app refused to be created with it. instead I used, a hint I got from stackoverflow. Also, I guess, @screen_name is a twitter handle like @MayoClinic? I'm a bit confused! Please, do help. Thank you. – doublestanding Apr 12 '17 at 11:31
  • How can I copy paste the "value", as it refused to copy paste unto my terminal, so I had to do manual copying. I suspect I could have copied it wrongly, though I have done it more than five times with all attention and carefulness I can muster. – doublestanding Apr 12 '17 at 11:38
  • I suspect the error is with API_KEY and API_SECRET, as the terminal outputs "invalid API_KEY and/or API_SECRET". Yes, @screen_name is a user's twitter name, such as @FoxNews. What do you mean you couldn't use the Harvard url? Are you referring to the link apps.twitter.com? – SuperNovaCoder Apr 12 '17 at 14:53
  • It could also help to restart your computer a few times as well as refresh all the open windows you have. I believe you are copying the values right, so I'm not quite sure why they aren't pasting into your terminal. – SuperNovaCoder Apr 12 '17 at 15:00


You could also contact Glenn Holloway at heads@cs50.harvard.edu and report the problem to him. It might take a while for him to reply, but I got in contact with him about a problem I had not too long ago and he was able to help me find an answer. – SuperNovaCoder

Has emailing Glenn Holloway at heads@cs50.harvard.edu helped at all? – SuperNovaCoder

@SuperNovaCoder, thanks so much for your help. The problem has been taken care of. – doublestanding

Like I said in the comment, emailing heads@cs50.harvard.edu might help solve the problem.

If this answers your question, please hit the green checkmark. If you still have issues, comment below.

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