RuntimeWarning: tp_compare

Chris Mellon arkanes at gmail.com
Tue Oct 9 16:43:49 EDT 2007


On 10/9/07, Bruno Barberi Gnecco
<brunobgDELETETHIS at users.sourceforge.net> wrote:
>         I'm getting the following exception when I call an external extension
> (pytst):
>
> /usr/lib/python2.5/threading.py:697: RuntimeWarning: tp_compare didn't return -1 or -2 for
> exception
>    return _active[_get_ident()]
> Traceback (most recent call last):
>    File "testDataMiner2.py", line 77, in <module>
>      testPlace()
>    File "testDataMiner2.py", line 41, in testPlace
>      data = db.getDescription(event['id'])
>    File "testDataMiner2.py", line 28, in getDescription
>      return self.getRow(query, (id,))
>    File "../database.py", line 73, in getRow
>      self.readlock.acquire()
>    File "/usr/lib/python2.5/threading.py", line 94, in acquire
>      me = currentThread()
>    File "/usr/lib/python2.5/threading.py", line 697, in currentThread
>      return _active[_get_ident()]
> UnicodeEncodeError: 'ascii' codec can't encode character u'\xfa' in position 52: ordinal
> not in range(128)
> awer
>  > /usr/lib/python2.5/threading.py(700)currentThread()
> -> return _DummyThread()
>
>
>         Note that the error occurs *after* the call that I isolated as
> affecting it (pytst.scan(), in the case). This doesn't happen for simple,
> isolated cases, but googling for "tp_compare threading" shows a lot of
> similar issues. Does anybody here know what this could be about? Any ideas
> to debug or work around it?
>

The various thread issues in the traceback aside, it looks like the
problem is that you passed a unicode object to pytst, which only
accepts plain (ascii) strings.



More information about the Python-list mailing list