summaryrefslogtreecommitdiff
path: root/py/demo/Ice/async/Client.py
diff options
context:
space:
mode:
authorMark Spruiell <mes@zeroc.com>2012-04-24 14:16:15 -0700
committerMark Spruiell <mes@zeroc.com>2012-04-24 14:16:15 -0700
commit943a48fc5c0a59b892eb746073c71b8dd88815e7 (patch)
tree421cfedbc60603d02e0b314d9204e9f85dd781c5 /py/demo/Ice/async/Client.py
parentminor fix to IcePHP getLogger (diff)
downloadice-943a48fc5c0a59b892eb746073c71b8dd88815e7.tar.bz2
ice-943a48fc5c0a59b892eb746073c71b8dd88815e7.tar.xz
ice-943a48fc5c0a59b892eb746073c71b8dd88815e7.zip
python 3 support
Diffstat (limited to 'py/demo/Ice/async/Client.py')
-rwxr-xr-xpy/demo/Ice/async/Client.py24
1 files changed, 13 insertions, 11 deletions
diff --git a/py/demo/Ice/async/Client.py b/py/demo/Ice/async/Client.py
index 06a654a9613..f41fe3bc32c 100755
--- a/py/demo/Ice/async/Client.py
+++ b/py/demo/Ice/async/Client.py
@@ -19,30 +19,30 @@ class Callback:
def exception(self, ex):
if isinstance(ex, Demo.RequestCanceledException):
- print "Demo.RequestCanceledException"
+ print("Demo.RequestCanceledException")
else:
- print "sayHello AMI call failed:"
- print ex
+ print("sayHello AMI call failed:")
+ print(ex)
def menu():
- print """
+ print("""
usage:
i: send immediate greeting
d: send delayed greeting
s: shutdown server
x: exit
?: help
-"""
+""")
class Client(Ice.Application):
def run(self, args):
if len(args) > 1:
- print self.appName() + ": too many arguments"
+ print(self.appName() + ": too many arguments")
return 1
hello = Demo.HelloPrx.checkedCast(self.communicator().propertyToProxy('Hello.Proxy'))
if not hello:
- print args[0] + ": invalid proxy"
+ print(args[0] + ": invalid proxy")
return 1
menu()
@@ -50,7 +50,9 @@ class Client(Ice.Application):
c = None
while c != 'x':
try:
- c = raw_input("==> ")
+ sys.stdout.write("==> ")
+ sys.stdout.flush()
+ c = sys.stdin.readline().strip()
if c == 'i':
hello.sayHello(0)
elif c == 'd':
@@ -63,14 +65,14 @@ class Client(Ice.Application):
elif c == '?':
menu()
else:
- print "unknown command `" + c + "'"
+ print("unknown command `" + c + "'")
menu()
except EOFError:
break
except KeyboardInterrupt:
break
- except Ice.Exception, ex:
- print ex
+ except Ice.Exception as ex:
+ print(ex)
return 0