Re: Question about raise and exceptions.
- From: Bruno Desthuilliers <bdesth.quelquechose@xxxxxxxxxxxxxxxxxxx>
- Date: Wed, 28 Feb 2007 22:03:13 +0100
Daniel Klein a écrit :
On Wed, 28 Feb 2007 13:48:54 -0500 (EST), "Steven W. Orr"
<steveo@xxxxxxxxxxx> 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,
Err...
eg:
msg = "Going to error state %d from state %d" % (self.curr_state,
newstate)
raise TransitionError(self, curr_state, newstate, msg)
Where did you see a tuple here ? You're code is *calling* TransitionError, passing it the needed arguments.
Note that it's the correct syntax - but not the correct explanation !-)
.
- Follow-Ups:
- Re: Question about raise and exceptions.
- From: Steven W. Orr
- Re: Question about raise and exceptions.
- References:
- Question about raise and exceptions.
- From: Steven W. Orr
- Re: Question about raise and exceptions.
- From: Daniel Klein
- Question about raise and exceptions.
- Prev by Date: Re: Curses and resizing windows
- Next by Date: Re: Yet another unique() function...
- Previous by thread: Re: Question about raise and exceptions.
- Next by thread: Re: Question about raise and exceptions.
- Index(es):
Relevant Pages
|