File: client.py

package info (click to toggle)
pyro 1%3A3.14-5
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 2,048 kB
  • ctags: 1,988
  • sloc: python: 11,194; xml: 128; sh: 52; makefile: 28
file content (53 lines) | stat: -rw-r--r-- 1,120 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/env python
import sys, os

sys.path.insert(0,os.pardir)		# to find testclient.py

import testclient
import Pyro.util

from excep import MyError

test = testclient.getproxy('exceptions')

print test.div(2.0,9.0)
try:
	print 2/0
except ZeroDivisionError,x:
	print 'DIVIDE BY ZERO',x
try:
	print test.div(2,0)
except ZeroDivisionError,x:
	print 'DIVIDE BY ZERO',x
try:
	result=test.error()
	print repr(result),result
except ValueError,x:
	print 'VALUERROR',x
try:
	result=test.error2()
	print repr(result),result
except ValueError,x:
	print 'VALUERROR',x
try:
	result=test.othererr()
	print repr(result),result
except MyError,x:
	print 'MYERROR',x
try:
	result=test.othererr2()
	print repr(result),result
except MyError,x:
	print 'MYERROR',x

print '*** invoking server method that crashes, catching traceback ***'
try:
	print test.complexerror()
except Exception,x:
	print 'CAUGHT ERROR, printing Pyro traceback >>>>>>',x
	print ''.join(Pyro.util.getPyroTraceback(x))
	print '<<<<<<< end of Pyro traceback'
	
print '*** invoking server method that crashes, not catching anything ***'
print test.complexerror()