Michael Mileusnich wrote:
>
> My apologies I was incorrect.  fname is being set to C:\Program
> Files\HQSystem\bin\hqmonitor.exe but alas the directory was empty.  I
> corrected this however I still cannot get my services to start. 
> Currently I use an example that invokes
> win32serviceutil.HandleCommandLine(MyService) but all that seems to do
> (on my python trace program) is give back the usage.  If I try to
> 'start' the service I get my service was unable to respond in a timely
> fashion error.

Well, wait a minute.  How is that possible?  How could "fname" get the
wrong path?  It was fetching the program's name from sys.argv[0], which
it should have fetched from the command line that started the service. 
Did you move the directory after you did the original service creation? 
Remember that the path to your service is stored in the registry.  I
hope it's obvious that this path MUST be correct if you plan to have
Windows start the service on its own.

> Correct my I am wrong but all Windows looks for is the SvcDoRun?

No, that's not right.  You need to remember the pieces that are involved
here.  Windows doesn't have any clue about Python.  It's just running
your service as a standard executable.  SvcDoRun is just a Python
function, which happens to be called by the PyWin32 service framework. 
Windows services work by receiving messages from the operating system --
messages that tell the service what to do.  There are messages for
start, stop, and pause, among others.  In response to the "start"
message, the Python framework will eventually call SvcRun, which then
calls your SvcDoRun.

Just because Python makes it easy, that doesn't change the way services
work.  The registry must be correct, and your service must operate like
a normal executable.

-- 
Tim Roberts, t...@probo.com
Providenza & Boekelheide, Inc.

_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to