dbus-python method access global

Ed Tsang netdesign_98 at yahoo.com
Wed Feb 3 12:08:36 PST 2010


Hi, I am really new to python and dbus and OO in general. I tried to implement some kind of footprint to see if a method is called.

......
global status
status = 0
class Agent(dbus.service.Object):
...
    @dbus.service.method("org.openobex.Agent",
                    in_signature="os", out_signature="")
    def Error(self, path, error):
        print "Transfer error: %s" % (error)
        status = 5
        print "current status: %d" % (status)        
        return

    @dbus.service.method("org.openobex.Agent",
                    in_signature="", out_signature="")
    def Release(self):
        print "Transfer Release status %d" % (status)
        mainloop.quit()
        return 
....
    client.SendFiles({ "Destination": sys.argv[1] }, sys.argv[2:], path)
    mainloop.run()
    print "end status: %d" % (status)
     sys.exit(status)

I know the Error method is called but the status did not get updated when Release is called. Could a method write into a global? If not is there a way to pass info back to the main loop when it exit?

Regards, Ed


      __________________________________________________________________
Be smarter than spam. See how smart SpamGuard is at giving junk email the boot with the All-new Yahoo! Mail.  Click on Options in Mail and switch to New Mail today or register for free at http://mail.yahoo.ca


More information about the dbus mailing list