python - tkinter.TclError: character U+1f449 is above the range (U+0000-U+FFFF) allowed by Tcl -


i trying show twitter timeline on tkinter window using tweepy. code

import tweepy import tkinter  consumer_key = 'xxxxxxxxxxxxxx' consumer_sec ='xxxxxxxxxxxxxxxxxxxxxxxxxxxxx' acc_token = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' acc_token_sec = 'xxxxxxxxxxxxxxxxxxxxxx' auth = tweepy.oauthhandler(consumer_key,consumer_sec) auth.set_access_token(acc_token,acc_token_sec)  api = tweepy.api(auth)  tweets = api.home_timeline()  tkwindow = tkinter.tk()  tweet in tweets:     = 1     label = tkinter.label(tkwindow, text=tweet.author.name + " " + str(tweet.created_at) + "\n" + str(tweet.text))     if == 5:         break tkwindow.mainloop() 

but having following error

_tkinter.tclerror: character u+1f449 above range (u+0000-u+ffff) allowed tcl

i understand tkinter can't show special icons appear in real tweets, actually, don't want show those, want show simple text of tweet,

so how can avoid error , show text of tweets

the easiest way strip out characters. done following code @ start of loop:

char_list = [tweet[j] j in range(len(tweet)) if ord(tweet[j]) in range(65536)] tweet='' j in char_list:     tweet=tweet+j 

Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -