S
Steven W. Orr
In my class I have
class Error(Exception):
"""Base class for exceptions in this module."""
pass
class TransitionError(Error):
"""Raised when an operation attempts a state transition that's not
allowed.
Attributes:
previous -- state at beginning of transition
next -- attempted new state
message -- explanation of why the specific transition is not allowed
"""
def __init__(self, previous, next, message):
self.previous = previous
self.next = next
self.message = message
Also in my class I check to see if a transition is legal or not:
newstate = self.fsm[self.curr_state][self._ev]
if newstate == self.error_state:
raise TransitionError, self.curr_state, newstate, \
"Going to error state %d from state %d" % (self.curr_state, newstate)
self.curr_state = self.fsm[newstate][self._ev]
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 carat is really under the comma before "Going.)
I hate to bother people with syntax problems, but I have no idea what to
do. Sorry.
TIA :-(
--
Time flies like the wind. Fruit flies like a banana. Stranger things have .0.
happened but none stranger than this. Does your driver's license say Organ ..0
Donor?Black holes are where God divided by zero. Listen to me! We are all- 000
individuals! What if this weren't a hypothetical question?
steveo at syslang.net
class Error(Exception):
"""Base class for exceptions in this module."""
pass
class TransitionError(Error):
"""Raised when an operation attempts a state transition that's not
allowed.
Attributes:
previous -- state at beginning of transition
next -- attempted new state
message -- explanation of why the specific transition is not allowed
"""
def __init__(self, previous, next, message):
self.previous = previous
self.next = next
self.message = message
Also in my class I check to see if a transition is legal or not:
newstate = self.fsm[self.curr_state][self._ev]
if newstate == self.error_state:
raise TransitionError, self.curr_state, newstate, \
"Going to error state %d from state %d" % (self.curr_state, newstate)
self.curr_state = self.fsm[newstate][self._ev]
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 carat is really under the comma before "Going.)
I hate to bother people with syntax problems, but I have no idea what to
do. Sorry.
TIA :-(
--
Time flies like the wind. Fruit flies like a banana. Stranger things have .0.
happened but none stranger than this. Does your driver's license say Organ ..0
Donor?Black holes are where God divided by zero. Listen to me! We are all- 000
individuals! What if this weren't a hypothetical question?
steveo at syslang.net