RE: evaluating sys.exc_value
Hammond, Mark ((@)
Thu, 26 Jan 95 08:46:00 PST
>try:
> print a
>except NameError:
> eval(str(sys.exc_value) + " = ''")
>
>
>This however, fails on a SyntaxError. I tryed it with repr() as well -
>no can do...
Im not at all sure what you are trying to do.
When the exception fails, are you just trying to ensure a valid "a".
Something like
try:
print a
except NameError:
a = None # or a = ""
Im not sure what you are trying to do with eval. Certainly, the code you
posted _is_ a Syntax error
Mark.