summaryrefslogtreecommitdiff
path: root/py/demo/book/printer/Client.py
diff options
context:
space:
mode:
Diffstat (limited to 'py/demo/book/printer/Client.py')
-rw-r--r--py/demo/book/printer/Client.py38
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)