diff options
author | Dwayne Boone <dwayne@zeroc.com> | 2007-08-30 13:37:21 -0230 |
---|---|---|
committer | Dwayne Boone <dwayne@zeroc.com> | 2007-08-30 13:37:21 -0230 |
commit | 16a985e3a93121f17d8025492472d51a7906c46a (patch) | |
tree | 5b158e09637562b2fb1ec662d4afcd69e257a3a0 /py/demo/book/printer/Client.py | |
parent | Squashed commit of the following: (diff) | |
download | ice-16a985e3a93121f17d8025492472d51a7906c46a.tar.bz2 ice-16a985e3a93121f17d8025492472d51a7906c46a.tar.xz ice-16a985e3a93121f17d8025492472d51a7906c46a.zip |
bug 2347 - added book demos to python
Diffstat (limited to 'py/demo/book/printer/Client.py')
-rw-r--r-- | py/demo/book/printer/Client.py | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/py/demo/book/printer/Client.py b/py/demo/book/printer/Client.py new file mode 100644 index 00000000000..17dec92ae88 --- /dev/null +++ b/py/demo/book/printer/Client.py @@ -0,0 +1,38 @@ +#!/usr/bin/env python +# ********************************************************************** +# +# Copyright (c) 2003-2007 ZeroC, Inc. All rights reserved. +# +# This copy of Ice is licensed to you under the terms described in the +# ICE_LICENSE file included in this distribution. +# +# ********************************************************************** + +import sys, traceback, Ice + +Ice.loadSlice('Printer.ice') +import Demo + +status = 0 +ice = None +try: + ic = Ice.initialize(sys.argv) + base = ic.stringToProxy("SimplePrinter:default -p 10000") + printer = Demo.PrinterPrx.checkedCast(base) + if not printer: + raise RuntimeError("Invalid proxy") + + printer.printString("Hello World!") +except: + traceback.print_exc() + status = 1 + +if ic: + # Clean up + try: + ic.destroy() + except: + traceback.print_exc() + status = 1 + +sys.exit(status) |