twitter-python
twitter-python copied to clipboard
data2spreadsheet
data2spreadsheet returns KeyError: "user"
any thoughts? didn't have issue on other system, am I missing a module?
Chris
Probably a json object that isn't a tweet (i.e., is a delete message or a limit message, etc.) and hence doesn't have a "user" object in it. This should be dug into further (e.g., if it's a delete message we should actually update the code to delete the corresponding tweet). As a quick fix, however, try changing
def parse(tweet):
tw=Tweet()
to
def parse(tweet):
if not "user" in tweet:
return
tw=Tweet()
which will just skip the lines that don't have a 'user' object in them.