stopping SimpleHTTPServer
dsavitsk
dsavitsk at e-coli.net
Tue Nov 19 16:08:02 EST 2002
"Alex Martelli" <aleax at aleax.it> wrote in message
news:AptC9.28393$744.1027998 at news1.tin.it...
> dsavitsk wrote:
* * *
> In your subclass, you need to override method handle_error, which by
> default processes all exceptions (including the SystemExit exception
> raised by sys.exit) by printing a traceback and continuing. Check if
> the exception is SystemExit and then re-raise it, otherwise delegate
> to your base-class's handle_error for normal error processing...
>
right. I am not getting something very fundamental, so this is a good
learning opportunity ...
I added a method as below (found from a Steve Holden post)
def handle_error(self, request, client_address):
import exceptions
etype, evalue = sys.exc_info()[:2]
if etype is exceptions.SystemExit: raise
print '-'*40
print 'Exception happened during processing of request from',
print client_address
import traceback
traceback.print_exc(1000, sys.stdout)
print '-'*40
sys.stdout.flush()
but it doesn't seem to be used upon an error. Instead the original
handle_error method is called. So how do I convince my program that this
one is the one to use? Python 2.1.3, b/t/w.
thanks
More information about the Python-list
mailing list