Inside the shell, I get the following response when I try to import my program.
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "tweet.py", line 26
print "Favorited: %s" % (result['text'])
^
SyntaxError: invalid syntax
Why does print "Favorited: %s" % (result['text']) return an error? Googling has been unhelpful, this was working for me earlier...
Update, I'm running the following version of Python:
Python 2.7.5 |Anaconda 1.6.1 (x86_64)| (default, Jun 28 2013, 22:20:13)
[GCC 4.0.1 (Apple Inc. build 5493)] on darwin
Update again, here is the function:
def fetch_tweet(tweet):
try:
result = t.favorites.create(_id=tweet['id'])
print "Favorited: %s" % (result['text'])
return result
# when you have already favourited a tweet, this error is thrown
except TwitterHTTPError as e:
print "Error: ", e
return None
Update #3 - found the error!
Turns out my python interpreter really hated a bit of code I had at the top, which was messing with print somehow - I deleted from __future__ import print_function from the top of the file and everything started working smoothly.