Advertisement
quiliro

Error apertium-tolk

Jan 19th, 2014
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.75 KB | None | 0 0
  1. Error with apertium-tolk every time a non-asci character is keyed:
  2. org.freedesktop.DBus.Python.UnicodeEncodeError: Traceback (most recent call last):
  3. File "/usr/lib/python2.7/dist-packages/dbus/service.py", line 707, in _message_cb
  4. retval = candidate_method(self, *args, **keywords)
  5. File "/usr/share/apertium/dbus-1/mode.py", line 61, in translate
  6. return translate.translate(self.mode, options, text)
  7. File "/usr/share/apertium/dbus-1/mode.py", line 46, in translate
  8. out, err = call(add_options([self.cmd, pair], options), text)
  9. File "/usr/share/apertium/dbus-1/command_line.py", line 13, in call
  10. child_in.write(_in)
  11. UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in position 0: ordinal not in range(128)
  12.  
  13. These are the solutions I tested:
  14. - i tryed to edit /usr/bin/python2.7 which is the file to which /usr/bin/python2 links .... but this file is binary
  15. - /usr/lib/python2.7/sitecustomize.py points to /etc/python2.7/sitecustomize.py and this file has content already so I didn't edit it:
  16. # install the apport exception handler if available
  17. try:
  18. import apport_python_hook
  19. except ImportError:
  20. pass
  21. else:
  22. apport_python_hook.install()
  23.  
  24. - I created a the files /usr/lib/python2.7/site-packages/sitecustomize.py and /usr/lib/python2.5/site-packages/sitecustomize.py and ~/-local/sitecustomize.py with the following text:
  25. # sitecustomize.py
  26. # this file can be anywhere in your Python path,
  27. # but it usually goes in ${pythondir}/lib/site-packages/
  28. import sys;
  29. sys.setdefaultencoding('utf-8');
  30. None worked.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement