Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Travis Griggs Newsgroups: comp.lang.python Subject: Confused by python-dbus weird behavior Date: Mon, 11 Jan 2016 14:14:05 -0800 Lines: 56 Message-ID: References: <4ac97a67-2527-424e-90e2-b714528977c8@googlegroups.com> Mime-Version: 1.0 (Mac OS X Mail 9.2 \(3112\)) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: news.uni-berlin.de Yvlu0KdpE3hTl1CtZxAs+wesxhvFV/9YLFLr97fgD/KQ== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.031 X-Spam-Evidence: '*H*': 0.94; '*S*': 0.00; 'attributes': 0.07; 'method,': 0.07; 'callback': 0.09; 'flags,': 0.09; 'i\xe2\x80\x99ve': 0.09; 'subclass': 0.09; 'python': 0.10; 'def': 0.13; 'subject:python': 0.14; 'calculator': 0.16; 'called,': 0.16; 'i\xe2\x80\x99m': 0.16; 'machinery.': 0.16; 'python3.': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'stuff,': 0.16; 'preferred': 0.20; 'to:name:python-list@python.org': 0.20; 'trying': 0.22; 'code.': 0.23; 'defined': 0.23; 'seems': 0.23; 'tried': 0.24; 'header:In-Reply-To:1': 0.24; 'sort': 0.25; 'example': 0.26; '(which': 0.26; 'linux': 0.26; 'skip:m 30': 0.27; 'not.': 0.27; 'question': 0.27; 'said,': 0.27; 'skip:( 20': 0.28; 'interface': 0.29; 'looks': 0.29; 'index,': 0.29; 'it\xe2\x80\x99s': 0.29; 'running.': 0.29; 'value)': 0.29; 'raise': 0.29; 'that.': 0.30; 'code': 0.30; 'skip:_ 10': 0.32; 'class': 0.33; 'call,': 0.33; 'message-id:@gmail.com': 0.34; 'know.': 0.34; 'list': 0.34; 'gets': 0.35; 'received:google.com': 0.35; 'skip:c 30': 0.35; 'interact': 0.35; 'involving': 0.35; 'returning': 0.35; 'something': 0.35; 'but': 0.36; 'should': 0.36; 'there': 0.36; 'received:209.85': 0.36; 'basic': 0.36; 'to:addr :python-list': 0.36; 'method': 0.37; 'seem': 0.37; 'received:209': 0.38; 'received:209.85.220': 0.38; 'end': 0.39; 'does': 0.39; 'subject:-': 0.39; 'to:addr:python.org': 0.40; 'where': 0.40; 'called': 0.40; 'some': 0.40; 'group,': 0.60; 'header:Message- Id:1': 0.61; 'fire': 0.63; 'more': 0.63; 'great': 0.63; 'hints': 0.66; 'here': 0.66; 'services': 0.67; 'directly.': 0.76; 'hoping': 0.77; 'areas.': 0.84; 'bus,': 0.84; 'forward.': 0.84; 'hope.': 0.84; 'itself?': 0.84; 'service)': 0.84; '\xe2\x80\xa6': 0.84; 'you\xe2\x80\x99re': 0.91; '8bit%:18': 0.93 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=content-type:mime-version:subject:from:in-reply-to:date :content-transfer-encoding:message-id:references:to; bh=QHbSixD2/zC7vZl5XS6oqW1M9JChdTYXg23oXnCjRUI=; b=OUe0brfB++IS8lUH3bqjS0Y/k7UTsduhUKYtmTLDoVwNpshugxOg7j55Mr/u+vahWF NFVC9MxW0AYY5rQA46B88ddWB4LeRm/Ci/Sq7lQuIrwIvfbAIpSlNNaKl7w+g73jvtKX OArBN2rFcSKppxjpm8eqKvYa2FT3Bb6l9fdjdGsYkVPLC03kZsPNqawyOuQGFnkcqKPq OEsXeK5YTYBCW1RGQ7YQw1k4JpWX08csZGH7zlxZkrrLJpcCuQqx2I8o+1QWQoEbGXZa l1xDeq431JqbRKIGEn9RsZd6KjpEsyF/w6o1VdvsGscdZ9rw7omg8GazfAnObmdG8rCF V5Iw== X-Received: by 10.66.252.6 with SMTP id zo6mr116808791pac.154.1452550446760; Mon, 11 Jan 2016 14:14:06 -0800 (PST) In-Reply-To: X-Mailer: Apple Mail (2.3112) X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:101496 This may not be a great list for this question (which would be?); it=E2=80= =99s a big group, and I=E2=80=99m hoping there=E2=80=99s some people = here that cross into these same areas. I=E2=80=99m new to dbus, it seems it=E2=80=99s a sort of CORBA for the = Linux world. :) Python seems to be a popular way to interact with it. = I=E2=80=99m trying to interact with the BlueZ services for Bluetooth LE = stuff, and the scant hints I can find seem to indicate dbus is the = preferred way going forward. The BlueZ distribution even provides = example code. That said, my question should be independent of whether = this was BLE or a dbus interface for a Calculator program. There is a class defined as such: class Characteristic(dbus.service.Object): def __init__(self, bus, index, uuid, flags, service): # =E2=80=A6 set a bunch of attributes dbus.service.Object.__init__(self, bus, self.path) @dbus.service.method(GATT_CHRC_IFACE, in_signature=3D'ay') def WriteValue(self, value): print('Default WriteValue called, returning error=E2=80=99) raise NotSupportedException() Then I have a subclass of my own: class MyCharacteristic(Characteristic): def __init__(self, bus, index, uuid, flags, service): Characteristic.__init__(self, bus, index, uuid, flags, = service) # =E2=80=A6 set some of my own attributes def WriteValue(self, value): print(=E2=80=98Got write value:=E2=80=99, value) self.anotherMethod(value) print(=E2=80=98back from anotherMethod=E2=80=99) def anotherMethod(self, value): print(=E2=80=98pondering this value:=E2=80=99, value) My program does not call WriteValue directly. It seems to be called by = the bluetooth machinery. The mainloop, or something like that. I don=E2=80= =99t honestly know. I just know I use some other boilerplate code = involving registration and the mainloop, to get it all running. And so = the MyCharacteristic.WriteValue() method DOES get fired. I see the = output. But when it gets to the anotherMethod call, it just seems to... = not. More callbacks may fire later. But that=E2=80=99s the end of that = one. I=E2=80=99ve tried this under python2 AND python3. So my basic python-dbus question is: Is this some nuance where a = callback method, inheriting from what looks like a proxy of some sort = (dbus.service.Object) should/can not send messages to itself? Help me python-obis, help me. You=E2=80=99re my only hope.