From: Mark H. <ski...@gm...> - 2013-05-01 23:52:55
|
On 2/05/2013 5:33 AM, Don Dwiggins wrote: > Mark, thanks for chiming in. > >> You might want to instrument your service so you can narrow down where >> the failure is - eg, add your own lines to print to the event log or >> to win32traceutil. > > I've been instrumenting win32serviceutuil, and have narrowed it down to > the following line in ServiceFramework.__init__: >> self.ssh = servicemanager.RegisterServiceCtrlHandler(args[0], >> self.ServiceCtrlHandlerEx, True) > This is after adding the following lines in HandleCommandLine's "start" > code, right after the "try:" >> global g_SvcInst >> g_SvcInst = cls(serviceName) > (This is definitely experimental -- I basically did in > HandleCommandLine's "start" code what DebugService does. Again, before > I did this, I was getting the "timeout" message.) Right - an error here would be expected as you are trying to call RegisterServiceCtrlHandler() in a process that isn't being started as a service. What does your instrumentation say happens without those additional lines? ... > This triggered a bit more exploration. > > I have both the source and the executable installed, under different > service names. Comparing the registry entries, I note that the value > for the subkey PythonClass is a full pathname for the source (ending in > "RCAServer.RCAService", which is the module name and the service class > name), but only "RCAServer.RCAService" for the executable. > (I just experimented by making the value a full path, then trying > "start" again -- didn't help, so I removed and reinstalled, which > restored the value to what it was.) This *should* be OK - in a py2exe generated service, the module name alone is (or should be) guaranteed to be importable, but for a "source" service it might not already be on sys.path, so a full path name is supported - you will find all this magic in boot_service.py (see below). I'd also experiment with the bundle_files option. Also note that service support is implements mainly via py2exe/boot_service.py, so if instrumenting your service code seems to show your module never being loaded, try instrumenting that file and rebuilding to see what it tells you. HTH, Mark > > I don''t know if I mentioned, but this is happening on a Windows 7 > Professional OS, 64 bit (but with 32 bit Python 2.7 and py2exe). > > > Hope this gives enough information to give you a clue... > > > Don > >> >> HTH, >> >> Mark >> >>> Perhaps I should mention that I'm using a recent Activestate 2.7 >>> distribution, which includes the win32 packages. >>> >>> Here's the setup.py: >>>> from distutils.core import setup >>>> import py2exe >>>> import sys, os, shutil >>>> >>>> class Target: >>>> def __init__(self, **kw): >>>> self.__dict__.update(kw) >>>> # for the versioninfo resources >>>> self.version = "0.5.0" >>>> self.company_name = "Advanced Publishing Technology" >>>> self.copyright = "" >>>> self.name = "Remote Client Access (RCA) Server" >>>> >>>> RCAservice = Target( >>>> # Used for the versioninfo resource >>>> description = "APT Circulation -- Remote Client Access Service", >>>> # What to build. For a service, the module name (not the >>>> # filename) must be specified! >>>> modules = ["RCAServer"], >>>> cmdline_style='pywin32', >>>> ) >>>> >>>> setup( >>>> service = [RCAservice], >>>> options = {"py2exe": {"compressed": 1, >>>> "optimize": 2, >>>> "bundle_files": 1, >>>> 'includes':['pyodbc', >>>> 'twisted.web.resource', 'decimal', >>>> # Needed for Python 2.5 lib -- >>>> also the ignores below >>>> 'email.utils', >>>> 'email.base64mime', >>>> 'email.generator', >>>> 'email.iterators', >>>> ], >>>> 'packages': [# The following to allow SA to >>>> find the MSSQL dialect >>>> 'sqlalchemy.dialects', >>>> ##'sqlalchemy.dialects.mssql', >>>> ##'sqlalchemy.dialects.mssql.pyodbc', >>>> ], >>>> 'ignores':['FCNTL', 'OpenSSL', 'resource', >>>> 'email.Utils', 'email.base64MIME', >>>> 'email.Iterators', >>>> 'email.Generator'], >>>> 'dll_excludes': [ "mswsock.dll", >>>> "powrprof.dll" ] >>>> }}, >>>> zipfile = None , >>>> ) >> >> ------------------------------------------------------------------------------ >> Introducing AppDynamics Lite, a free troubleshooting tool for Java/.NET >> Get 100% visibility into your production application - at no cost. >> Code-level diagnostics for performance bottlenecks with <2% overhead >> Download for free and get started troubleshooting in minutes. >> http://p.sf.net/sfu/appdyn_d2d_ap1 > > > > ------------------------------------------------------------------------------ > Introducing AppDynamics Lite, a free troubleshooting tool for Java/.NET > Get 100% visibility into your production application - at no cost. > Code-level diagnostics for performance bottlenecks with <2% overhead > Download for free and get started troubleshooting in minutes. > http://p.sf.net/sfu/appdyn_d2d_ap1 > _______________________________________________ > Py2exe-users mailing list > Py2...@li... > https://lists.sourceforge.net/lists/listinfo/py2exe-users > |