[!] Error: 'ascii' codec can't encode characters in position 7-14: ordinal not in range(128)
w116tjb opened this issue · 4 comments
root@Linux1:~/tweets_analyzer# python tweets_analyzer.py --name Snowden
[+] Getting @snowden account data...
[+] lang : en
[+] geo_enabled : False
[+] time_zone : Eastern Time (US & Canada)
[+] utc_offset : -14400
[+] statuses_count : 2130
[+] Retrieving last 1000 tweets...
100%|####################################################################################################################################################################################################| 1000/1000 [00:08<00:00, 119.15tw/s]
[+] Downloaded 1000 tweets from 2016-09-01 18:10:12 to 2017-06-06 22:35:51 (278 days)
[+] Average number of tweets per day: 3.6
Daily activity distribution (per hour)
###############################################################################
0 00:00 (-)
0 01:00 (-)
0 02:00 (-)
0 03:00 (-)
1 04:00 (-)
0 05:00 (-)
2 06:00 (-)
[!] Error: 'ascii' codec can't encode characters in position 7-8: ordinal not in range(128)
had the same issue, line 241, encode the printed line like following: print(line.encode("utf-8"))
I am also having same issue. I am using Python 2.7 and Robot Framework.
[ ERROR ] 'ascii' codec can't encode character u'\u25b3' in position 13: ordinal not in range(128)
print(listname.encode("utf-8")) did not work for me. I am trying to fetch list of values from my web page and store it in list.
Tried various options it did not work for me. Any suggestions?
could you please tell what command/options you wrote to get this error, so we can test on our side?
did you try with multiple screen_names?
this is still an encoding issue, but the mentioned character (http://unicode.scarfboy.com/?s=U%2B25B3) is not used anywhere in the code, so this must be related to the data you collect and output
if I were you I would try different character encodings other than utf-8, and there is also a stackoverflow thread which could help you https://stackoverflow.com/a/9942822
def list2_value(self):
list2 = self.parent.get_list_values("xpath")
print (list2.encode("utf-8"))
This is what I have tried. Looks like my list has one of the character (like a small triangle) as specified in (http://unicode.scarfboy.com/?s=U%2B25B3). Any idea how to deal with this?
I also tried the stack overflow guide which did not work for me.