File tree Expand file tree Collapse file tree 3 files changed +35
-6
lines changed
Expand file tree Collapse file tree 3 files changed +35
-6
lines changed Original file line number Diff line number Diff line change @@ -19,4 +19,7 @@ def meanage(filename):
1919
2020 return str (mean_age )
2121
22+ def dividezero (x ):
23+ return x / 0
24+
2225# print(meanage("/home/irisowner/dev/data/titanic.csv"))
Original file line number Diff line number Diff line change 1- numpy == 1.23.4
2- pandas == 1.5.0
3- dataclasses-json == 0.5.7
4- sqlalchemy-iris == 0.10.5
5- flask == 2.3.3
6- requests == 2.31.0
1+ numpy
2+ pandas
3+ dataclasses-json
4+ sqlalchemy-iris
5+ flask
6+ requests
Original file line number Diff line number Diff line change @@ -35,4 +35,30 @@ ClassMethod TitanicMeanAge() As %Status
3535 Return sc
3636}
3737
38+ ClassMethod DivideByZero () As %Status
39+ {
40+ Set sc = $$$OK
41+ set tt =##class (%SYS.Python ).Import (" sample" )
42+ try {
43+ write " divide by zero=" _tt .dividezero (1 )
44+ #dim ex as %Exception.PythonException
45+ } catch ex {
46+ do ex .Log ()
47+ write " Caught exception: " , ex .DisplayString (), !
48+ }
49+ Return sc
50+ }
51+
52+ ClassMethod DivideByZeroPython () [ Language = python ]
53+ {
54+ import sample
55+ import iris
56+ try :
57+ print (" divide by zero=" + str (sample .dividezero (1 )))
58+ except ZeroDivisionError as e :
59+ errobj =iris .cls (" %Exception.General" )._New (str (e ),42 )
60+ a =errobj .Log ()
61+ print (" Caught exception: " + str (e ))
62+ }
63+
3864}
You can’t perform that action at this time.
0 commit comments