0

builtins.SyntaxError File "/home/ubuntu/workspace/pset6/sentiments/application.py", line 26 return redirect (url_for("index")) ^ SyntaxError: 'return' outside function

1 Answer 1

1

Here's a trick that might make the API_KEY/SECRET easier to manage. Create a new file in your sentiments directory (I call mine twitkeys). Type or copy/paste the two export commands into this file and save it. Your file will look something like

export API_KEY=whatever export API_SECRET=whatever

(of course your KEY and SECRET instead of whatever).

Now for the trick: before you run tweets run this: $ . ./twitkeys. Yes that is "dot space dot slash twitkeys". I forget the technical explanation, but the first . (dot) will put the stuff in twitkeys into your environment.

As for the 'return outside function' error, could be as simple as a bad indent. Without seeing the code it's impossible to say.

1
  • thanks a million for that secret. It solved the problem before I finally discovered the culprit in my tweet code. I'm really grateful for the help. Apr 17, 2017 at 16:33

You must log in to answer this question.

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