Opps forgot to do a reply all on my response to Michael Hi,
To get python network servers running as a window service I have found that you need to launch a separate python.exe process from the python windows service. Then you stop and start this via your python windows service script. The Zope2 windows service code will help you head in the right direction: http://svn.zope.org/Zope/trunk/lib/python/nt_svcutils/service.py To debug the remote running network server you can use the win32trace.pyd/win32traceutil.py combination. This tool is a lifesave if you doing any window python dev work for services or isapi. Copied from the python win32 extensions page is an explanation of what it does: "These modules allow one Python process to generate output via a "print" statement, and another unrelated Python process to display the data. This works even if the Python process generating the output is running under the context of a service, where more traditional means are not available. The module works on Windows 95 and Windows NT. To enable this debugging, simply "import win32traceutil" somewhere in your program - thats it! This automatically re-directs the standard Python output streams to the remote collector (If that behaviour is undesirable, you will need to use win32trace directly.) To actually see the output as it is produced, start a DOS prompt, and run the file "win32traceutil.py" (eg, double-click on it from Explorer, or "python.exe win32traceutil.py") This will print all output from all other Python processes (that have imported win32traceutil) until you kill it with Ctrl+Break!) You should ensure that only one "collector" process is running at a time. If not, only one of the collector processes will see the output - although which process gets which bit of output is indeterminate! Also, there is a limitation of 64k of buffered data. If 64k of data is stored before any collector has read it, the buffer will be emptied, and filled from the start. This means previous output is lost. This should only ever happen if an output process has been running for a while with no collector running. " Regards Mark On Jan 9, 2008 11:49 AM, Michael Chesterton <[EMAIL PROTECTED]> wrote: > > I don't suppose anyone here knows anything about windows services > under python? > I'll take any advice or sympathy. > > From: [EMAIL PROTECTED] > Subject: windows service > Date: 8 January 2008 11:42:47 AM > To: [EMAIL PROTECTED] > > I'm trying to get a program that uses M2Crypto ThreadingSSLServer to > run in windows as a service. I have a few problem, it doesn't listen > on its port and I don't know how to debug it. > > I used the pipeservice example as a framework to get it running as a > service > > def SvcDoRun(self): > # Write an event log record - in debug mode we will also > # see this message printed. > servicemanager.LogMsg( > servicemanager.EVENTLOG_INFORMATION_TYPE, > servicemanager.PYS_SERVICE_STARTED, > (self._svc_name_, '') > ) > > daemonserver = do_daemon() > while 1: > daemonserver.handle_request() > > I think I need a way to break out of that while loop when a service > stop is sent, but not knowing what happening at that point I'm not > sure how. It's not even listening on its port. > > daemonserver is > > daemonserver = SSL.ThreadingSSLServer((host_ip_addr, int > (host_port_num)), TestRequestHandler, ctx) > > any help? > > -- > Michael Chesterton > http://chesterton.id.au/blog/ > http://barrang.com.au/ > > > > _______________________________________________ > coders mailing list > [email protected] > http://lists.slug.org.au/listinfo/coders > _______________________________________________ coders mailing list [email protected] http://lists.slug.org.au/listinfo/coders
