"UCS-2' codec ne peut pas encoder des caractères en position 1050-1050

Lorsque j'exécute mon code Python, j'obtiens les erreurs suivantes:

  File "E:\python343\crawler.py", line 31, in <module>
    print (x1)
  File "E:\python343\lib\idlelib\PyShell.py", line 1347, in write
    return self.shell.write(s, self.tags)
UnicodeEncodeError: 'UCS-2' codec can't encode characters in position 1050-1050: Non-BMP character not supported in Tk

Voici mon code:

x = g.request('search', {'q' : 'TaylorSwift', 'type' : 'page', 'limit' : 100})['data'][0]['id']

# GET ALL STATUS POST ON PARTICULAR PAGE(X=PAGE ID)
for x1 in g.get_connections(x, 'feed')['data']:
    print (x1)
    for x2 in x1:
        print (x2)
        if(x2[1]=='status'):
            x2['message']

Comment puis-je résoudre ce problème?

si vous avez besoin de voir les bmp caractères Unicode; vous pouvez exécuter python de manière interactive dans l'environnement qui peut montrer par exemple, dans ConEmu de la console ou d'un navigateur web. Essayez de ipython notebook.

OriginalL'auteur Andi | 2015-09-07