D
D'Arcy J.M. Cain
I am having a strange problem and I can't seem to zero in on it. I am
also having trouble reducing it to a small enough snippet that I can
post here. I think that I am doing what the more complex script does
but none of my attempts fail. So, here is a description just in case
someone has seen something that smells like this and can suggest some
areas to do further poking.
I have a class that subclasses xmlrpcserver.RequestHandler. It has a
method that takes a function name that it looks up with getattr. It
then calls the looked up method in this try/except block:
try:
return server_method(pkt)
except Exception, failure:
syslog(LOG_WARNING, "%s, %s" % (Exception, failure))
self.print_tb(sys.exc_info())
try: fault = self.faultConverter.errorToFault(failure)
except Exception, err:
syslog(LOG_ERR, "Error processing failure: %r" % err)
fault = xmlrpclib.Fault(8002, "Internal error")
syslog(LOG_DEBUG, "Converted failure %r to fault %r (%r)" %
\ (failure, fault, failure))
if fault.faultCode < 10000:
syslog(LOG_ERR, "Unconverted fault: %r" % failure)
return fault
This class is then subclassed by another class that adds the methods
that are to be looked up. Those methods may raise exceptions if there
are errors.
Under Python 2.4 this works fine. If an exception is raised in the
looked up method it gets handled by this code just fine. Under 2.5,
however, the exception is not caught here. It's as if there was no
try/except here at all.
I'm not sure if I have left off some critical piece of information or
just littered this post with red herrings. I'm open to both
reasoned suggestions as well as wild speculation.
also having trouble reducing it to a small enough snippet that I can
post here. I think that I am doing what the more complex script does
but none of my attempts fail. So, here is a description just in case
someone has seen something that smells like this and can suggest some
areas to do further poking.
I have a class that subclasses xmlrpcserver.RequestHandler. It has a
method that takes a function name that it looks up with getattr. It
then calls the looked up method in this try/except block:
try:
return server_method(pkt)
except Exception, failure:
syslog(LOG_WARNING, "%s, %s" % (Exception, failure))
self.print_tb(sys.exc_info())
try: fault = self.faultConverter.errorToFault(failure)
except Exception, err:
syslog(LOG_ERR, "Error processing failure: %r" % err)
fault = xmlrpclib.Fault(8002, "Internal error")
syslog(LOG_DEBUG, "Converted failure %r to fault %r (%r)" %
\ (failure, fault, failure))
if fault.faultCode < 10000:
syslog(LOG_ERR, "Unconverted fault: %r" % failure)
return fault
This class is then subclassed by another class that adds the methods
that are to be looked up. Those methods may raise exceptions if there
are errors.
Under Python 2.4 this works fine. If an exception is raised in the
looked up method it gets handled by this code just fine. Under 2.5,
however, the exception is not caught here. It's as if there was no
try/except here at all.
I'm not sure if I have left off some critical piece of information or
just littered this post with red herrings. I'm open to both
reasoned suggestions as well as wild speculation.