From: Mark H. <ski...@gm...> - 2013-04-30 23:08:58
|
On 1/05/2013 2:15 AM, Don Dwiggins wrote: > Thanks for the reply... > > On 4/29/13 2:12 PM, Manuel Silva wrote: >> >> Hi Don, >> You can use event viewer to debug. If you can't find any message in >> the event viewer than it is must be in your setup file. >> > There's no events showing. I doubt that it's the setup file, since the > frozen executable works (starts and serves requests successfully) in > debug mode. 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. > >> Can you show us your setup file? >> > > See below. > >> I've found some differences between starting from source and running >> the .exe while accesing files and parsing arguments. Any of these in >> your code? >> > > I've run into that too (running in a different folder in source vs. the > executable), and coded around it. It's not an issue here, though. Also you will be running as a different user. This generally means no network access. > I'm really curious why win32serviceutil doesn't instantiate the service > class during "start" processing, especially since it's in > ServiceFramework.__init__ that servicemanager.RegisterServiceCtrlHandler > gets called. I assume you have tested your service without py2exe, so win32serviceutil must be doing the right thing. FWIW, win32serviceutil's implementation of "start" just asks Windows to start the service. That process ends up looking in the registry for the executable specified for the named service and starting it. At this point, pythonservice.exe is what is used (or a py2exe built exe in this case), and it then also looks up the registry to find the classname, and *it* instantiates the class. Thus, win32serviceutil's process is *not* the service process - except in debug mode. 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 , >> ) > |