Hi all, I have written a slightly modified version of the CGIHTTPServer; the difference with the module included in the standard python distrubution is that, since I know that the CGI to be executed is a python script, I always execute it via the execfile() function, instead of opening a separate process. But there's a problem: in the CGI, I'm using the cgitb module to catch exceptions and send them to the browser. This doesn't work. Here is what happens when a exception is raised from the CGI:
1) the client (HTTP browser) waits for data, which don't came (while I'd like the cgitb module to display the exception); 2) the exception is propagated to the CGIHTTPServer, which shows it on the standard error (where noone will ever see it); 3) when I interrupt the HTTP server with Ctrl+C, the KeyboardInterrupt exception is sent (beautified by cgitb) to the HTTP browser!!! I can correct (3) by saving the value of sys.excepthook before the call to execfile and restoring it in the finally clause, but this doesn't solve my problem. Is there a way to run a python file as if it were a separate process? That is, forbidding execfile() to modify anything in the caller? -- Saluti, Mardy http://interlingua.altervista.org -- http://mail.python.org/mailman/listinfo/python-list