S
Sylwia
Hi!
I have implemented a Python services. It behaves as a supervisor for
log files.
If the space used by log files is bigger than a given upper limit,
then it starts to delete log files until the space is less than a
given lower limit. It checks the space every 1000 secs. After that it
falls asleep. It is configured to start up automatically on system
boot. Everything works ok except one thing ... The service should
run even when I log off, so I made an experiment. It turned out that
after relogging (I have to press Ctrl+Ald+Del) the following exception
was raised:
The instance's SvcRun() method failed
File "C:\Python23\lib\site-packages\win32\lib\win32serviceutil.py",
line 663, in SvcRun
self.SvcDoRun()
File "C:\SEE\modules\adminapps\purgeLogFilesService.py", line 158,
in SvcDoRun
time.sleep(1000)
exceptions.IOError: (4, 'Interrupted function call')
Here is the part of my code (inside SvcDoRun) that generates the
error:
#check if the service is going to be stopped
timeout=5
waitHandles = self.hWaitStop,
stp = win32event.WaitForMultipleObjects(waitHandles, 0,
timeout)
if stp == win32event.WAIT_OBJECT_0:
#print "Received Quit from Win32"
break
else:
time.sleep(1000) # <--- Exception generated here!!!
How can I solve it? Maybe I should try to patch a new timemodule.c
file? I have no idea I would be greatful for any hints.
I use Windows XP operating system.
Best wishes,
Sylwia
I have implemented a Python services. It behaves as a supervisor for
log files.
If the space used by log files is bigger than a given upper limit,
then it starts to delete log files until the space is less than a
given lower limit. It checks the space every 1000 secs. After that it
falls asleep. It is configured to start up automatically on system
boot. Everything works ok except one thing ... The service should
run even when I log off, so I made an experiment. It turned out that
after relogging (I have to press Ctrl+Ald+Del) the following exception
was raised:
The instance's SvcRun() method failed
File "C:\Python23\lib\site-packages\win32\lib\win32serviceutil.py",
line 663, in SvcRun
self.SvcDoRun()
File "C:\SEE\modules\adminapps\purgeLogFilesService.py", line 158,
in SvcDoRun
time.sleep(1000)
exceptions.IOError: (4, 'Interrupted function call')
Here is the part of my code (inside SvcDoRun) that generates the
error:
#check if the service is going to be stopped
timeout=5
waitHandles = self.hWaitStop,
stp = win32event.WaitForMultipleObjects(waitHandles, 0,
timeout)
if stp == win32event.WAIT_OBJECT_0:
#print "Received Quit from Win32"
break
else:
time.sleep(1000) # <--- Exception generated here!!!
How can I solve it? Maybe I should try to patch a new timemodule.c
file? I have no idea I would be greatful for any hints.
I use Windows XP operating system.
Best wishes,
Sylwia