I have a python script that connects to the Twitter Firehose and sends data downstream for processing. Before it was working fine, but now I'm trying to get only text body. (It's not a question about how I should extract data from Twitter or how do encode/decode ascii characters). So when I launch my script directly like this:
python -u fetch_script.py
It works just fine, and I can see messages are coming to the screen. For example:
root@domU-xx-xx-xx-xx:/usr/local/streaming# python -u fetch_script.py
Cuz I'm checking you out >on Facebook<
RT @SearchlightNV: #BarryLies
Since nobody's jumped in yet, here's my shot. Python sets stdout's encoding when writing to a console but not when writing to a file. This script shows the problem
Running shows the error
Add the encoding
and the problem is solved