From: Brian O. <br...@qi...> - 2006-02-17 16:13:50
|
Hello, I wrote a small program which I am trying to run as a service. I built the program as a service and then tried to run it. The traceback I got back is: File "boot_service.py", line 170, in ? pywintypes.error: (1063, 'StartServiceCtrlDispatcher', 'The service process could not connect to the service controller.') To see if it was not just an isolated problem, I built the sample service in samples/advanced. That builds fine, but when I try to run it, the same error as above comes up. I don't know what I can do to proceed from here. Is there something I am not doing? I am using XP with Python 2.4.2, py2exe 0.6.3, win32 extensions build 207. Thanks in advance for any help offered. Brian |
From: Thomas H. <th...@py...> - 2006-02-17 16:49:38
|
Brian Olsen wrote: > Hello, > > I wrote a small program which I am trying to run as a service. I built the > program as a service and then tried to run it. The traceback I got back > is: > > File "boot_service.py", line 170, in ? > pywintypes.error: (1063, 'StartServiceCtrlDispatcher', 'The service > process could not connect to the service controller.') > > To see if it was not just an isolated problem, I built the sample service > in samples/advanced. That builds fine, but when I try to run it, the same > error as above comes up. You don't run the service yourself - windows does it for you after you have it installed. Doesn't the exe print this help? Services are supposed to be run by the system after they have been installed. These command line options are available for (de)installation: -help -install -remove -auto -disabled -interactive -user: <arg> -password: <arg> You can install the service by running 'yourexe -install', and then start and stop it via control panel. Thomas |
From: Brian O. <br...@qi...> - 2006-02-17 17:57:54
|
> Is this the error you are getting? If you you need to actually install >the service and run it from the control panel, you can't run a windows service > by just launching the exe. you need to '-install' or '-remove' the > service using the exe and then start using the control panel > You don't run the service yourself - windows does it for you after you > have it installed. > Doesn't the exe print this help? > Services are supposed to be run by the system after they have been > installed. > These command line options are available for (de)installation: > -help > -install > -remove > -auto > -disabled > -interactive > -user: <arg> > -password: <arg> > > > You can install the service by running 'yourexe -install', and then > start and stop it via control panel. Thanks Gordon and Thomas. I got the sample service working. However, for my script, it responded that it was not starting up in a timely fashion, which led me to assume that running the exe on the command line will give me information why it is doing this. (I guess it doesn't. :) It seems to be instead something in my code that is causing my original problem (which I am slowly finding now.) Brian |
From: Gordon S. <gsc...@gm...> - 2006-02-17 18:34:42
|
try posting some of your code, But it sounds like your service is crashing. Check the EventLog to see if there are any application messages. A common problem is using 'print' statements. A windows service does not have a stdout, so if you are using 'print' statements it can crash. On 2/17/06, Brian Olsen <br...@qi...> wrote: > > > Is this the error you are getting? If you you need to actually install > >the service and run it from the control panel, you can't run a windows > service > > by just launching the exe. you need to '-install' or '-remove' the > > service using the exe and then start using the control panel > > > > You don't run the service yourself - windows does it for you after you > > have it installed. > > Doesn't the exe print this help? > > Services are supposed to be run by the system after they have been > > installed. > > These command line options are available for (de)installation: > > -help > > -install > > -remove > > -auto > > -disabled > > -interactive > > -user: <arg> > > -password: <arg> > > > > > > You can install the service by running 'yourexe -install', and then > > start and stop it via control panel. > > > > Thanks Gordon and Thomas. > > I got the sample service working. > > However, for my script, it responded that it was not starting up in a > timely fashion, which led me to assume that running the exe on the comman= d > line will give me information why it is doing this. (I guess it doesn't. > :) It seems to be instead something in my code that is causing my origina= l > problem (which I am slowly finding now.) > > Brian > > > > > ------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. Do you grep through log > files > for problems? Stop! Download the new AJAX search engine that makes > searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! > http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D103432&bid=3D230486&dat= =3D121642 > _______________________________________________ > Py2exe-users mailing list > Py2...@li... > https://lists.sourceforge.net/lists/listinfo/py2exe-users > |
From: Jim V. <Jim...@no...> - 2006-02-17 18:42:43
|
Have you tried running the service in DEBUG mode from a command line where it does have access to a console window? Note, my knowledge of py2exe is "stale", but last I knew, there was no provision to run in DEBUG mode if py2exe was used, but it is possible to do so prior to bundling the code in py2exe. Gordon Scott wrote: > try posting some of your code, But it sounds like your service is > crashing. Check the EventLog to see if there are any application > messages. > > A common problem is using 'print' statements. A windows service does > not have a stdout, so if you are using 'print' statements it can crash. > > > On 2/17/06, *Brian Olsen* <br...@qi... > <mailto:br...@qi...>> wrote: > > > Is this the error you are getting? If you you need to actually > install > >the service and run it from the control panel, you can't run a > windows > service > > by just launching the exe. you need to '-install' or '-remove' the > > service using the exe and then start using the control panel > > > > You don't run the service yourself - windows does it for you > after you > > have it installed. > > Doesn't the exe print this help? > > Services are supposed to be run by the system after they > have been > > installed. > > These command line options are available for (de)installation: > > -help > > -install > > -remove > > -auto > > -disabled > > -interactive > > -user: <arg> > > -password: <arg> > > > > > > You can install the service by running 'yourexe -install', and then > > start and stop it via control panel. > > > > Thanks Gordon and Thomas. > > I got the sample service working. > > However, for my script, it responded that it was not starting up in a > timely fashion, which led me to assume that running the exe on the > command > line will give me information why it is doing this. (I guess it > doesn't. > :) It seems to be instead something in my code that is causing my > original > problem (which I am slowly finding now.) > > Brian > > > > > ------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. Do you grep through > log files > for problems? Stop! Download the new AJAX search engine that makes > searching your log files as easy as surfing the web. DOWNLOAD > SPLUNK! > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642 > <http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642> > _______________________________________________ > Py2exe-users mailing list > Py2...@li... > <mailto:Py2...@li...> > https://lists.sourceforge.net/lists/listinfo/py2exe-users > > |
From: Thomas H. <th...@py...> - 2006-02-17 18:44:55
|
Jim Vickroy wrote: > Have you tried running the service in DEBUG mode from a command line > where it does have access to a console window? > > Note, my knowledge of py2exe is "stale", but last I knew, there was no > provision to run in DEBUG mode if py2exe was used, but it is possible to > do so prior to bundling the code in py2exe. That is correct. And it would be a good addition for py2exe. Thomas |
From: Mark H. <mha...@sk...> - 2006-02-17 22:24:56
|
> Jim Vickroy wrote: > > Have you tried running the service in DEBUG mode from a command line > > where it does have access to a console window? > > > > Note, my knowledge of py2exe is "stale", but last I knew, there was no > > provision to run in DEBUG mode if py2exe was used, but it is > possible to > > do so prior to bundling the code in py2exe. > > That is correct. And it would be a good addition for py2exe. I've actually got a patch sitting around here that allows you to specify: service_cmdline_handling = [py2exe, pywin32, custom] py2exe is as now, pywin32 uses pywin32's style, and custom is designed to allow you to specify your own. I've been meaning to check it in, but am a little stuck at the moment with other things in the latest py2exe being a little broken for my projects. I need to add some of those samples I've also got around to help demonstrate the new errors. Mark |
From: Brian O. <br...@qi...> - 2006-02-17 22:43:22
|
> try posting some of your code, But it sounds like your service is > crashing. Check the EventLog to see if there are any application > messages. > > A common problem is using 'print' statements. A windows service does not > have a stdout, so if you are using 'print' statements it can crash. > > > On 2/17/06, Brian Olsen <br...@qi...> wrote: >> >> > Is this the error you are getting? If you you need to actually >> install >> >the service and run it from the control panel, you can't run a windows >> service >> > by just launching the exe. you need to '-install' or '-remove' the >> > service using the exe and then start using the control panel >> >> >> > You don't run the service yourself - windows does it for you after you >> > have it installed. >> > Doesn't the exe print this help? >> > Services are supposed to be run by the system after they have been >> > installed. >> > These command line options are available for (de)installation: >> > -help >> > -install >> > -remove >> > -auto >> > -disabled >> > -interactive >> > -user: <arg> >> > -password: <arg> >> > >> > >> > You can install the service by running 'yourexe -install', and then >> > start and stop it via control panel. >> >> >> >> Thanks Gordon and Thomas. >> >> I got the sample service working. >> >> However, for my script, it responded that it was not starting up in a >> timely fashion, which led me to assume that running the exe on the >> command >> line will give me information why it is doing this. (I guess it doesn't. >> :) It seems to be instead something in my code that is causing my >> original >> problem (which I am slowly finding now.) >> >> Brian >> >> >> >> >> ------------------------------------------------------- >> This SF.net email is sponsored by: Splunk Inc. Do you grep through log >> files >> for problems? Stop! Download the new AJAX search engine that makes >> searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! >> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642 >> _______________________________________________ >> Py2exe-users mailing list >> Py2...@li... >> https://lists.sourceforge.net/lists/listinfo/py2exe-users >> > |
From: Brian O. <br...@qi...> - 2006-02-17 23:08:36
|
Sorry about this last message; it doesn't have my response which I was going to CC to the list here. > try posting some of your code, But it sounds like your service is > crashing. Check the EventLog to see if there are any application > messages. > > A common problem is using 'print' statements. A windows service does not > have a stdout, so if you are using 'print' statements it can crash. I got it to sort of work; it now starts the service up properly, but now it does not shut it down properly. I did not originally write it with making it a service in mind, so I assume there is something in there that is making it not cleanly shut down. I am not in front of this code now, but I think this is just a silly coding error on my part (hopefully.) Brian |
From: Gordon S. <gsc...@gm...> - 2006-02-17 23:27:53
|
Most likely you're not looking for the shutdown notification. Try a google search on writing NT services. Your service will be called asynchronously (in another thread) when the control manager wants your service to shutdown. It's up to you to look for this event and break out of your processing loop when this occurs. With py2exe, if you're sublcassing win32serviceutil.ServiceFramework, SvcStop is called when you need to shutdown. Normally you see something lik= e this where a worker does the real 'work' of the service, you have to internally make sure that the worker is checking to see if it needs to quit and exit it's loop class MyService(win32serviceutil.ServiceFramework): def __init__(self): worker =3D Worker() #create a worker object to do the real work def SvcStop(self): """windows wants you to stop the service""" worker.setStopFlag() def SvcRun(self): """windows wants you to run the service""" worker.runMainLoop() On 2/17/06, Brian Olsen <br...@qi...> wrote: > > Sorry about this last message; it doesn't have my response which I was > going to CC to the list here. > > > try posting some of your code, But it sounds like your service is > > crashing. Check the EventLog to see if there are any application > > messages. > > > > A common problem is using 'print' statements. A windows service does > not > > have a stdout, so if you are using 'print' statements it can crash. > > I got it to sort of work; it now starts the service up properly, but now > it does not shut it down properly. I did not originally write it with > making it a service in mind, so I assume there is something in there that > is making it not cleanly shut down. > > I am not in front of this code now, but I think this is just a silly > coding error on my part (hopefully.) > > Brian > > > > > ------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. Do you grep through log > files > for problems? Stop! Download the new AJAX search engine that makes > searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! > http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D103432&bid=3D230486&dat= =3D121642 > _______________________________________________ > Py2exe-users mailing list > Py2...@li... > https://lists.sourceforge.net/lists/listinfo/py2exe-users > |