From: <ora...@ya...> - 2002-11-09 21:07:32
|
Hi, I have defined my own EtError exception like this: interp.exec ( "class EtError(Exception): \n"+ " def __init__(self, value): \n"+ " self.value = value \n"+ " def __str__(self): \n"+ " return `self.value` \n" ); I throw it here: interp.exec ( "def pow(*args): \n"+ " if len(args) != 2: \n"+ " raise EtError('powError') \n"+ " return __builtin__.pow(*args) \n" ); In my Java program I catch a PyException. I can catch Py.SyntaxError and Py.NameError fine. But when I catch my own EtError I have no way of identify it. In value I get 'org.python.core.PyInstance@2f60ce' not 'powError' as I expected and getMessage/text is null. How do I identify my exception? Does anybody know? Regards, Peter Lorenzen Beskyt din computer mod virus og misbrug! Læs mere i Yahoo! Sikkerhedscenter på www.yahoo.dk/sikkerhedscenter |