Using SimpleXMLRPCServer in a Windows Service

Gabriel Genellina gagsl-py at yahoo.com.ar
Wed Nov 29 03:06:25 EST 2006


At Tuesday 28/11/2006 05:49, Rudy Schockaert wrote:

>I found the problem.
>Actually both pieces of code work now. The problem was that when I run
>the SimpleXMLRPCService in a Windows Service, the STDERR needs to be
>redirected to a real file. I guess some kind of buffer overflow occurs
>when you don't do this.
>
>I added the following lines:
>
><snip>
>def SvcStop(self):
>    sys.stdout = self.stdout
>    sys.stderr = self.stderr
>    .....
>
>
>def SvcDoRun(self):
>    self.stdout = sys.stdout
>    self.stderr = sys.stderr
>    sys.stdout = file("c:/temp/my.log", "a+", 0)
>    sys.stderr = sys.stderr
>    ....
></snip>

Actually you don't have to restore the previous value; Python already 
saves the original value in sys.__stderr__ and restores it when 
program finishes.


-- 
Gabriel Genellina
Softlab SRL 

__________________________________________________
Correo Yahoo!
Espacio para todos tus mensajes, antivirus y antispam ¡gratis! 
¡Abrí tu cuenta ya! - http://correo.yahoo.com.ar



More information about the Python-list mailing list