python - Struggling to handle emoji in tweepy script due to encoding issues -
this killing me , i'm struggling it... have utf-8 related issue python.
essentially trying pull stuff csv files tweet. involves picking column of emoji so:
t4 = function(random_line_from_csv_column_with_emoji) tweet = t1.decode('utf-8') + " " + t2.decode('utf-8') + " " + t3.decode('utf-8') + " " + t4.decode('utf-8') return tweet
then file uses tweepy streaming api pull tweet module code above, , status update e.g.
chatresponse = get_the_tweet_above(options) replytext = '@' + screenname + ' ' + chatresponse twitterapi.update_status(status=replytext)
most of time, code works... fails due encoding issues, e.g.:
'ascii' codec can't encode character u'\u0001f63a' in position 0: ordinal not in range(128) 'ascii' codec can't encode character u'\u0001f943' in position 0: ordinal not in range(128)
those emoji, smiling cat face , clinking glasses or tumbler or something...
basically, tearing hair out try , work out how stop happening. always run encoding issues in python , have never got head around it.
if can make work quick , easy answer i'd happy!
Comments
Post a Comment