Ascii codec can't encode

luca72 lucaberto at libero.it
Thu Oct 30 09:31:52 EDT 2008


the arror are:

>>> Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/lib/python2.5/site-packages/eric4/DebugClients/Python/
DebugClientBase.py", line 1006, in __unhandled_exception
    self.mainThread.user_exception(None, (exctype,excval,exctb), 1)
  File "/usr/lib/python2.5/site-packages/eric4/DebugClients/Python/
DebugBase.py", line 538, in user_exception
    self._dbgClient.eventLoop()
  File "/usr/lib/python2.5/site-packages/eric4/DebugClients/Python/
DebugClientBase.py", line 921, in eventLoop
    self.readReady(self.readstream.fileno())
  File "/usr/lib/python2.5/site-packages/eric4/DebugClients/Python/
AsyncIO.py", line 67, in readReady
    self.handleLine(s)
  File "/usr/lib/python2.5/site-packages/eric4/DebugClients/Python/
DebugClientBase.py", line 311, in handleLine
    self.__dumpVariables(int(frmnr), int(scope), filter)
  File "/usr/lib/python2.5/site-packages/eric4/DebugClients/Python/
DebugClientBase.py", line 1128, in __dumpVariables
    vlist = self.__formatVariablesList(keylist, dict, scope, filter)
  File "/usr/lib/python2.5/site-packages/eric4/DebugClients/Python/
DebugClientBase.py", line 1594, in __formatVariablesList
    valtypestr = unicode(type(value))[1:-1]
TypeError: unbound method __unicode__() must be called with
NavigableString instance as first argument (got nothing instead)

Original exception was:
Traceback (most recent call last):
  File "/usr/lib/python2.5/site-packages/eric4/DebugClients/Python/
DebugClient.py", line 38, in <module>
    debugClient.main()
  File "/usr/lib/python2.5/site-packages/eric4/DebugClients/Python/
DebugClientBase.py", line 1900, in main
    self.__interact()
  File "/usr/lib/python2.5/site-packages/eric4/DebugClients/Python/
DebugClientBase.py", line 897, in __interact
    self.eventLoop()
  File "/usr/lib/python2.5/site-packages/eric4/DebugClients/Python/
DebugClientBase.py", line 921, in eventLoop
    self.readReady(self.readstream.fileno())
  File "/usr/lib/python2.5/site-packages/eric4/DebugClients/Python/
AsyncIO.py", line 67, in readReady
    self.handleLine(s)
  File "/usr/lib/python2.5/site-packages/eric4/DebugClients/Python/
DebugClientBase.py", line 445, in handleLine
    execfile(sys.argv[0], self.debugMod.__dict__)
  File "/home/luca11/Desktop/prova.py", line 36, in <module>
    file_ricerca.write(frase_ric)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in
position 8: ordinal not in range(128)

I have solve in this way:

file_ricerca = codecs.open('ri', 'wb', 'ISO-8859-15', 'repalce')

That is not exact what i want because instead of the 'é' i get '?' but
the loop contine.
Thanks

Luca





More information about the Python-list mailing list