Skip to content

Commit 9642d11

Browse files
committed
updated exception handling to be python2.6+ and python3 compatible
1 parent 326d7b3 commit 9642d11

5 files changed

Lines changed: 11 additions & 4 deletions

File tree

ChangeLog

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
2013-06-24 Richard Murray <murray@altura-2.local>
2+
3+
* tests/minreal_test.py (TestMinreal.testMinrealBrute),
4+
src/xferfcn.py (_convertToTransferFunction), src/statesp.py
5+
(StateSpace.__rmul__), src/margins.py (stability_margins): changed
6+
exception syntax to be python3 compatibile (works for python2.6+)
7+
18
2013-06-10 Richard Murray <murray@altura-2.local>
29

310
* src/xferfcn.py (TransferFunction.horner): small fix to docstring

src/margins.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ def stability_margins(sysdata, deg=True, returnall=False, epsw=1e-12):
127127
sys = frdata.FRD(mag*np.exp((1j/360.)*phase), omega, smooth=True)
128128
else:
129129
sys = xferfcn._convertToTransferFunction(sysdata)
130-
except Exception, e:
130+
except Exception as e:
131131
print (e)
132132
raise ValueError("Margin sysdata must be either a linear system or "
133133
"a 3-sequence of mag, phase, omega.")

src/statesp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ def __rmul__(self, other):
351351
D = X * self.D
352352
return StateSpace(self.A, self.B, C, D, self.dt)
353353

354-
except Exception, e:
354+
except Exception as e:
355355
print(e)
356356
pass
357357
raise TypeError("can't interconnect systems")

src/xferfcn.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1053,7 +1053,7 @@ def _convertToTransferFunction(sys, **kw):
10531053
num = [[[D[i,j]] for j in range(inputs)] for i in range(outputs)]
10541054
den = [[[1] for j in range(inputs)] for i in range(outputs)]
10551055
return TransferFunction(num, den)
1056-
except Exception, e:
1056+
except Exception as e:
10571057
print("Failure to assume argument is matrix-like in"
10581058
" _convertToTransferFunction, result %s" % e)
10591059

tests/minreal_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def testMinrealBrute(self):
5353
self.assert_numden_almost_equal(
5454
ht1.num[0][0], ht2.num[0][0],
5555
ht1.den[0][0], ht2.den[0][0])
56-
except Exception, e:
56+
except Exception as e:
5757
# for larger systems, the tf minreal's
5858
# the original rss, but not the balanced one
5959
if n < 6:

0 commit comments

Comments
 (0)