Re: IOError in windows service

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Gabriel Genellina

    Re: IOError in windows service

    En Mon, 26 May 2008 06:41:26 -0300, Aspersieman <aspersieman@gm ail.comescribió :
    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\Li b\site-packages\win32\ lib\win32servic eutil.py",
    line 785, in SvcRun
    self.SvcDoRun()
    File "C:\Program Files\Program\M yService.py", line 28, in SvcDoRun
    print "Entering while loop..."
    <type 'exceptions.IOE rror'>: (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.
    Usually services don't have a console attached so sys.stdout is invalid. Just don't print anything...

    --
    Gabriel Genellina

Working...