<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body text="#000000" bgcolor="#FFFFFF">
I'm trying to access colord from Python using the GIR bindings. I
can connect to colord and perform simple queries, but queries that
return a list are not working. <br>
<br>
Here's an example that attempts to distill the problem, (The direct
accesses for printing the client.ref_count and dev.ref_count values
work on Ubuntu 13.04 by not Fedora 18, so are commented out. ) <br>
<br>
The problem arises when trying to access one device in the list
returned by <font face="monospace">client.get_devices_sync(cancellable)</font>.
Trying to do <font face="monospace">dev.connect_sync()</font> on
the device in the list causes a seg fault. If I insert the dir(dev)
line, that fails with the slightly more useful error message: <br>
<br>
<font face="monospace">ERROR:../../../gi/_gobject/pygobject.c:618:pygobject_switch_to_toggle_ref:
assertion failed: (self->obj->ref_count >= 1)<br>
Aborted (core dumped)<br>
</font><br>
What am I doing wrong? <br>
<br>
Sanford<br>
<br>
<br>
<br>
<font face="monospace">def simple_failure(): <br>
print "(wrapcolord.simple_failure) Starting"<br>
cancellable = Gio.Cancellable.new();<br>
client = Colord.Client.new()<br>
print
dir(client)
# works<br>
# no client.ref_count attribute on
Fedora <br>
# print "Before client.connect_sync(), client.ref_count=",
client.ref_count # 1 <br>
client.connect_sync(cancellable)<br>
# print "After client.connect_sync(), client.ref_count=%d" %
client.ref_count # 2 <br>
print "daemon
version=",client.get_daemon_version() #
a simple call to show connection is working<br>
devices = client.get_devices_sync(cancellable)<br>
print ' len(devices) = ',
len(devices) # 4 <br>
print
dir(devices)
# it's just a simple list <br>
for dev in devices: <br>
# print " One device. dev.ref_count = ",
dev.ref_count # 0 !!! <br>
print
dir(dev)
# Assertion fails and abort <br>
dev.connect_sync(cancellable)
# If print dir(dev) is commented out, seg fault here<br>
<br>
</font><br>
</body>
</html>