[Telepathy] Accessing Folks from python, part 2

Tomeu Vizoso tomeu at tomeuvizoso.net
Thu Jan 26 01:29:59 PST 2012


On Thu, Jan 26, 2012 at 10:15, Philip Withnall <philip at tecnocode.co.uk> wrote:
> On Tue, 2012-01-24 at 10:30 +0100, Tomeu Vizoso wrote:
>> On Mon, Jan 23, 2012 at 17:45, Philip Withnall <philip at tecnocode.co.uk> wrote:
>> > On Mon, 2012-01-23 at 16:21 +0100, Frederik Elwert wrote:
>> >> Am Montag, den 23.01.2012, 14:40 +0000 schrieb Philip Withnall:
>> >> > On Mon, 2012-01-23 at 10:22 +0100, Frederik Elwert wrote:
>> >> > > Hello,
>> >> > >
>> >> > > I am still trying to write a Folks client in Python. Thanks again for
>> >> > > the fast fix for my last issue.
>> >> > >
>> >> > > Since I had some trouble getting folks 0.6.6 running on Ubuntu 11.10, I
>> >> > > just upgraded to 12.04, which has folks 0.6.6. Now I am trying again to
>> >> > > digg into the python/Folks combo.
>> >> > >
>> >> > > I tried with this simple test script:
>> >> > >
>> >> > > ----8<----
>> >> > > from gi.repository import GObject
>> >> > > from gi.repository import Folks
>> >> > >
>> >> > >
>> >> > > def list_individuals():
>> >> > >     for key in aggregator.props.individuals.props.keys:
>> >> > >         print aggregator.props.individuals.get(key)
>> >> > >
>> >> > > aggregator = Folks.IndividualAggregator.new()
>> >> > > aggregator.prepare(None, None)
>> >> > >
>> >> > > GObject.timeout_add(2000, list_individuals)
>> >> > >
>> >> > > main_loop = GObject.MainLoop()
>> >> > > main_loop.run()
>> >> > > ---->8----
>> >> > >
>> >> > > Now I get this traceback:
>> >> > >
>> >> > > Traceback (most recent call last):
>> >> > >   File "folkstest.py", line 6, in list_individuals
>> >> > >     for key in aggregator.props.individuals.props.keys:
>> >> > > TypeError: '__main__.GeeHashMapKeySet' object is not iterable
>> >> > >
>> >> > > So the gee bindings seem not to work the python way. I read the gee API
>> >> > > doc, and then came up with something I had hoped would work:
>> >> > >
>> >> > > ----8<----
>> >> > > def list_individuals():
>> >> > >     iterator = aggregator.props.individuals.props.keys.iterator()
>> >> > >     while iterator.has_next():
>> >> > >         iterator.next()
>> >> > >         key = iterator.get()
>> >> > >         print aggregator.props.individuals.get(key)
>> >> > > ---->8----
>> >> > >
>> >> > > This, however, segfaults. The issue seems to be the iterator.get()
>> >> > > method call. I tried to get a backtrace using gdb, but since my
>> >> > > debugging skills are very limited, I am not sure how useful it is. I
>> >> > > attached it anyways, if you need more information, please just let me
>> >> > > know.
>> >> >
>> >> > You should be able to trim the code down to:
>> >> >
>> >> > while iterator.next():
>> >> >     key = iterator.get()
>> >> >     print aggregator.props.individuals.get(key)
>> >>
>> >> Okay, I changed my sample script accordingly. Thanks for the hint.
>> >> However, still segfaulting.
>> >>
>> >> > To my untrained eye, it looks like Python doesn't like the code, though,
>> >> > since the stack trace contains a call to "PyErr_Print". If you inspected
>> >> > this frame more closely (e.g. "frame 48; info locals" in gdb) that might
>> >> > give a hint.
>> >> >
>> >> > In any case, could you use the "backtrace full" command in gdb to get a
>> >> > more detailed stack trace please?
>> >>
>> >> I did this, please see the attached backtrace.
>> >
>> > Looks like you're missing debug information for Python. Could you make
>> > sure you've got the Python runtime debug symbols installed and get a
>> > better stack trace please?
>> >
>> > Hopefully then someone who knows about PyGObject can take a look at it.
>>
>> Hi, it looks like a (transfer none) annotation that should be
>> (transfer full) or the other way around.
>
> Any idea as to where? In libgee or libfolks?

Nope, could be anywhere. I would try reducing the test case until I
know what's the call that causes it.

Regards,

Tomeu


More information about the telepathy mailing list