Skip to content

Examples on SlipDBus Trac site do not work. #3

@awood

Description

@awood

Environment: Fedora 23, Python 2.7.11, python-slip 0.6.4, dbus-python 1.2.0, dbus 1.10.8

The example provided on https://fedorahosted.org/python-slip/wiki/SlipDBusService is not working.

  • The Python interpreter throws an error if the scripts are used as it:

    Traceback (most recent call last):
      File "./service.py", line 29, in <module>
        run_service ()
      File "./service.py", line 22, in run_service
        example_object = example_object.ExampleObject (name, "/org/example/ExampleObject")
    UnboundLocalError: local variable 'example_object' referenced before assignment
    
  • Renaming that variable leads to a service that just times out.

    % ./service.py &
    [1] 20622
    Running the example dbus service at 'org.example.ExampleService'.
    % dbus-send --session --print-reply --type=method_call --dest='org.example.ExampleService' '/org/example/ExampleObject' org.example.ExampleObject.hello_world  
    Error org.freedesktop.DBus.Error.NoReply: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.
    [1]  + 20622 done       ./service.py  
    

    Walking through with the debugger, it looks like when slip adds the ASYNC_CALLBACKS tuple, those values confuse dbus.service into thinking the method is an async method. It looks like slip is attempting to remove those dummy ASYNC_CALLBACKS values if the method is not async, but it's not working. When the code returns to

    # we're done - the method has got callback functions to reply with
    if parent_method._dbus_async_callbacks:
        return
    

    in dbus.service, parent_method still has values in the _dbus_async_callbacks tuple.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions