if args.output is not None: with open(args.output, "a") as myfile: tweetText = tweetText + separator myfile.write(tweetText.encode('utf-8')) else: print tweetText keywords = [] # reading keywords from input file with open(args.input) as f: kws = f.read().split("\n") keywords = [kw.strip() for kw in kws if len(kw) > 0] grap = TweetGrapper() #Search Mode #------------------ if "search" == args.mode.lower(): print "Activating search mode" if args.location is not None and args.lang is not None: grap.search(keywords, writeTweet, args.location, args.lang) else: grap.search(keywords, writeTweet) #STREAM Mode #------------------ elif "stream" == args.mode.lower(): print "Activating stream mode" if args.location is not None and args.lang is not None: