I am trying to follow the exemplary code of the book "Extraction of a social network", 1-3.
I know it is old, so I follow the new sample from the web page enter the link description here
BUT, SOMETIMES, I will experience an error while implementing the code:
[ trend.decode('utf-8') for trend in world_trends()[0]['trends'] ]
And the error information looks like this:
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "build/bdist.macosx-10.6-universal/egg/twitter/api.py", line 167, in __call__ File "build/bdist.macosx-10.6-universal/egg/twitter/api.py", line 173, in _handle_response File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/encodings/utf_8.py", line 16, in decode return codecs.utf_8_decode(input, errors, True) UnicodeDecodeError: 'utf8' codec can't decode byte 0x8b in position 1: unexpected code byte
This does not always happen, but I think that no programmer likes this random case.
So can anyone help me on this issue? What is the problem and how can I solve it?
Thanks a lot ~
pounds
source share