<div>I'm trying to setup an application that runs as a Windows service to rotate logs upon receiving a certain signal. Whenever I try to do this I get the following error.</div>
<blockquote dir="ltr" style="MARGIN-RIGHT: 0px">
<div>Exception in TestService.SvcStart: signal only works in main thread</div></blockquote>
<div>Attached is a very trimmed down example. To run the example and see the error message, do the following.</div>
<ol>
<li>In one DOS window run PYTHONHOME\Lib\site-packages\win32\lib\win32traceutil.py to begin collecting trace output.</li>
<li>In a separate DOS window run "python tsvc.py --username domain\user --password yourpassword --startup auto install" using your own user and password.</li>
<li>Using Start > Control Panel > Administrative Tools > Services, modify the service properties, modifying the user and password again (even though you already specified them) and click OK. Accept any prompts about granting the appropriate rights to run as a service.
</li>
<li>Run "net start tsvc"</li>
<li>Observe the error in the win32traceutil window.</li></ol>
<div>I realize this is a known problem but am unsure how to get around it to make sure my log rotation works when receiving the signal. Does anyone have any ideas on how to get around this limitation?</div>
<div> </div>
<div>Thanks.</div>
<div>Justin</div>