pbinkley / twarc-report

Data conversions and examples for generating reports from twarc collections using tools such as D3.js
Creative Commons Zero v1.0 Universal
55 stars 6 forks source link

some #10

Open remagio opened 8 years ago

remagio commented 8 years ago

Hi, frequently I redirect reports to text files on my debians & OSXs, to keep trace about ongoing Twarcs. But in the first IF...THEN...ELSE 4 lines lack of .encode("utf-8") when calling sparkline.sparkify() to print percentiles. Adding .encode("utf-8"), like you do in all other calls, at lines 25-29-33-37 solve the following errors:

reportprofile.py tweets.json > reporttweets.txt
Traceback (most recent call last):
  File "../twarc-report/reportprofile.py", line 25, in <module>
    print "User percentiles: " + sparkline.sparkify(data["userspercentiles"])
UnicodeEncodeError: 'ascii' codec can't encode characters in position 18-27: ordinal not in range(128)

Sorry if I'm not doing a pull/request, but I'm not sure it happens to all users.