<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-15"
 http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Gabriel Genellina wrote:
<blockquote cite="mid:op.ubrrlujtx6zn5v@a98gizw.cpe.telecentro.net.ar"
 type="cite">
  <pre wrap="">En Mon, 26 May 2008 06:41:26 -0300, Aspersieman <a class="moz-txt-link-rfc2396E" href="mailto:aspersieman@gmail.com"><aspersieman@gmail.com></a> escribió:

  </pre>
  <blockquote type="cite">
    <pre wrap="">I have a script (attached) that creates a windows service. Basically the
service periodically runs a program 'program.exe'. This all works fine,
but during testing I discovered that if I include any 'print' statements
(used to debug the service when its run in 'debug' mode), when _not_ in
debug mode, it throws an error:

<error>
The instance's SvcRun() method failed
  File "C:\Python25\Lib\site-packages\win32\lib\win32serviceutil.py",
line 785, in SvcRun
    self.SvcDoRun()
  File "C:\Program Files\Program\MyService.py", line 28, in SvcDoRun
    print "Entering while loop..."
<type 'exceptions.IOError'>: (9, 'Bad file descriptor')
</error>

I have removed the 'print' statements, after which the service runs
fine, but was just curious to find out the reason for this error.
    </pre>
  </blockquote>
  <pre wrap=""><!---->
Usually services don't have a console attached so sys.stdout is invalid. Just don't print anything...

  </pre>
</blockquote>
Thanks - seems logical. <br>
<br>
Regards<br>
<br>
Nicol<br>
<br>
<pre class="moz-signature" cols="72">-- 

The three things to remember about Llamas:
1) They are harmless
2) They are deadly
3) They are made of lava, and thus nice to cuddle. 

</pre>
</body>
</html>