diff options
author | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2012-12-21 23:15:30 +0200 |
---|---|---|
committer | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2012-12-21 23:26:11 +0200 |
commit | c7ea48bd5234ad44356339b076fff3b4d226cf37 (patch) | |
tree | 68c31e9a0e5b6a0f756957d1588b3d037a12efe3 /test/simple-obex-agent | |
parent | 20baf80f00ec24b65de22e98b801757216ea9356 (diff) | |
download | bluez-c7ea48bd5234ad44356339b076fff3b4d226cf37.tar.gz |
test: Make OBEX related scripts python 3 compatible
Diffstat (limited to 'test/simple-obex-agent')
-rwxr-xr-x | test/simple-obex-agent | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/test/simple-obex-agent b/test/simple-obex-agent index 72f04f324..f15e9d1d6 100755 --- a/test/simple-obex-agent +++ b/test/simple-obex-agent @@ -1,5 +1,7 @@ #!/usr/bin/python +from __future__ import absolute_import, print_function, unicode_literals + import gobject import sys @@ -13,6 +15,12 @@ AGENT_MANAGER_INTERFACE = 'org.bluez.obex.AgentManager1' AGENT_INTERFACE = 'org.bluez.obex.Agent1' TRANSFER_INTERFACE = 'org.bluez.obex.Transfer1' +def ask(prompt): + try: + return raw_input(prompt) + except: + return input(prompt) + class Agent(dbus.service.Object): def __init__(self, conn=None, obj_path=None): dbus.service.Object.__init__(self, conn, obj_path) @@ -26,7 +34,7 @@ class Agent(dbus.service.Object): properties = transfer.GetAll(TRANSFER_INTERFACE); self.pending_auth = True - raw_input("Authorize (%s, %s) (Y/n):" % (path, + auth = ask("Authorize (%s, %s) (Y/n):" % (path, properties['Name'])) if auth == "n" or auth == "N": @@ -42,7 +50,7 @@ class Agent(dbus.service.Object): @dbus.service.method(AGENT_INTERFACE, in_signature="", out_signature="") def Cancel(self): - print "Authorization Canceled" + print("Authorization Canceled") self.pending_auth = False if __name__ == '__main__': @@ -58,7 +66,7 @@ if __name__ == '__main__': mainloop = gobject.MainLoop() manager.RegisterAgent(path) - print "Agent registered" + print("Agent registered") cont = True while cont: |