twitter-python icon indicating copy to clipboard operation
twitter-python copied to clipboard

data2spreadsheet

Open chrism91 opened this issue 9 years ago • 1 comments

data2spreadsheet returns KeyError: "user"

any thoughts? didn't have issue on other system, am I missing a module?

Chris

chrism91 avatar May 26 '15 22:05 chrism91

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.

computermacgyver avatar May 26 '15 23:05 computermacgyver