Question about raise and exceptions.
Daniel Klein
danielkleinad at gmail.com
Wed Feb 28 14:12:17 EST 2007
On Wed, 28 Feb 2007 13:48:54 -0500 (EST), "Steven W. Orr"
<steveo at syslang.net> wrote:
>When I run it I get this:
>
>884 > ./t_fsm.py
>Traceback (most recent call last):
> File "./t_fsm.py", line 3, in ?
> from fsm import *
> File "/home/boston/VIASAT/sorr/py/fsm/fsm.py", line 76
> raise TransitionError, self.curr_state, newstate, "Going to error
>state %d from state %d" % (self.curr_state, newstate)
> ^
>SyntaxError: invalid syntax
The arguments for TransitionError must be a tuple, eg:
msg = "Going to error state %d from state %d" % (self.curr_state,
newstate)
raise TransitionError(self, curr_state, newstate, msg)
Dan
More information about the Python-list
mailing list