jbrew / pt-voicebox

predictive text interface
MIT License
286 stars 68 forks source link

'ascii' codec can't encode character #21

Open misuba opened 7 years ago

misuba commented 7 years ago

I'm using a corpus slurped from Twitter by a Node script. Sometimes just after adding a word I get this error:

Traceback (most recent call last):
  File "bin/voicebox", line 11, in <module>
    vb.write()
  File "/Users/sugarbaker/Documents/sen_markov/pt-voicebox/voicebox/voicebox.py", line 100, in wr
ite
    self.display_suggestions(suggestions)
  File "/Users/sugarbaker/Documents/sen_markov/pt-voicebox/voicebox/voicebox.py", line 359, in di
splay_suggestions
    info_string = "%s: %s" % (i + 1, str(suggestions[i][0]))
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2026' in position 3: ordinal not in 
range(128)

I haven't checked to see what that character is... this should be fun, hang on.

...it's an ellipsis.

Oh god I just saw what I did there. But, okay.

wybenga42 commented 6 years ago

Still an issue with a number of characters including right \u2018 and left \u2019.

Traceback (most recent call last):
  File "bin/voicebox", line 11, in <module>
    vb.write()
  File "/Users/brandon/Projects/pt-voicebox/voicebox/voicebox.py", line 100, in write
    self.display_suggestions(suggestions)
  File "/Users/brandon/Projects/pt-voicebox/voicebox/voicebox.py", line 359, in display_suggestions
    info_string = "%s: %s" % (i + 1, str(suggestions[i][0]))
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2019' in position 5: ordinal not in range(128)
negativecopy commented 6 years ago

I get the same error—don't know if anyone is still interested in updating/fixing pt-voicebox, but I'd sure love it if this particular error could be addressed. Pasted the error below.

Traceback (most recent call last): File "bin/voicebox", line 11, in vb.write() File "/Users/Home/Desktop/pt-voicebox/voicebox/voicebox.py", line 100, in write self.display_suggestions(suggestions) File "/Users/Home/Desktop/pt-voicebox/voicebox/voicebox.py", line 359, in display_suggestions info_string = "%s: %s" % (i + 1, str(suggestions[i][0])) UnicodeEncodeError: 'ascii' codec can't encode character u'\u2019' in position 2: ordinal not in range(128)