Thank you Tim, I will do this tonight.
Massimo P.S. making a new binary distro is as easy as unpacking and replacing the pyc file in the library.zip file. Massimo On Jan 5, 9:25 am, Timothy Farrell <tfarr...@swgen.com> wrote: > OK. Iceberg, yours shouldn't be too difficult, but it's going to take a bit > of time. > For Fran and Massimo, I've attached a patched winservice.py This will show a > traceback of the particular error in the Window's Event Viewer. That should > help us narrow the problem. Fran, you can copy this into your web2py.gluon > directory. Massimo, if you could put this in a checkout and compile it (I > don't have the time right now to figure out compiling), Iceberg and I can > debug the binary distribution. > Thanks, > tim > Iceberg wrote:Thank for your message, Tim. For me, I only tried the binary > distribution. After web2py.exe -W install, a service named "web2py Service" > appears in the windows service console. However, web2py.exe -W start does not > work. Details is in my last post (not this one). Rumors said that starting as > a service is only possible for a source distribution. So I think Fran's > problem would be a little easier than mine. :-S Thanks for your concern. > Iceberg On Jan5, 10:53pm, Timothy Farrell<tfarr...@swgen.com>wrote:Sorry > guys. I generally only watch the list at work. Being it a holiday, I'm a > little behind on this issue. Let me recap the symptoms so you know that I > understand... Source Distribution windows service installs but does not run > for Fran. Neither source nor binary Distribution installs (or runs) for > Iceberg. Is that correct? Iceberg from your last message, it looks like > you're having a path issue. I'll get a fresh machine and start with the > Binary distribution and get back to you. -tim-- Timothy > Farrell<tfarr...@swgen.com>Computer Guy Statewide General Insurance Agency > (www.swgen.com) > > [winservice.py3K ]""" > This file is part of web2py Web Framework (Copyrighted, 2007) > Developed by Massimo Di Pierro <mdipie...@cs.depaul.edu> > and Limodou <limo...@gmail.com> > License: GPL v2 > """ > import time, os, sys, traceback > import win32serviceutil > import win32service > import win32event > import servicemanager > import _winreg > from fileutils import up > > __all__=['web2py_windows_service_handler'] > > class Service(win32serviceutil.ServiceFramework): > _svc_name_ = '_unNamed' > _svc_display_name_ = '_Service Template' > def __init__(self, *args): > win32serviceutil.ServiceFramework.__init__(self, *args) > self.stop_event = win32event.CreateEvent(None, 0, 0, None) > def log(self, msg): > servicemanager.LogInfoMsg(str(msg)) > def SvcDoRun(self): > self.ReportServiceStatus(win32service.SERVICE_START_PENDING) > try: > self.ReportServiceStatus(win32service.SERVICE_RUNNING) > self.start() > win32event.WaitForSingleObject(self.stop_event, > win32event.INFINITE) > except: > self.log(traceback.format_exc(sys.exc_info)) > self.SvcStop() > self.ReportServiceStatus(win32service.SERVICE_STOPPED) > def SvcStop(self): > self.ReportServiceStatus(win32service.SERVICE_STOP_PENDING) > try: > self.stop() > except: > self.log(traceback.format_exc(sys.exc_info)) > win32event.SetEvent(self.stop_event) > self.ReportServiceStatus(win32service.SERVICE_STOPPED) > # to be overridden > def start(self): pass > # to be overridden > def stop(self): pass > > class Web2pyService(Service): > _svc_name_ = 'web2py' > _svc_display_name_ = 'web2py Service' > _exe_args_ = 'options' > server = None > > def chdir(self): > try: > h = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, > r'SYSTEM\CurrentControlSet\Services\%s' % self._svc_name_) > cls = _winreg.QueryValue(h, 'PythonClass') > dir = os.path.dirname(cls) > os.chdir(dir) > return True > except: > self.log("Can't change to web2py working path, server is stopped") > return False > > def start(self): > self.log("web2py server starting") > if not self.chdir(): return > if len(sys.argv) == 2: > opt_mod = sys.argv[1] > else: > opt_mod = self._exe_args_ > options = __import__(opt_mod, [], [], '') > from main import HttpServer > self.server = HttpServer(ip=options.ip,port=options.port, > password=options.password, > pid_filename=options.pid_filename, > log_filename=options.log_filename, > ssl_certificate=options.ssl_certificate, > ssl_private_key=options.ssl_private_key, > numthreads=options.numthreads, > server_name=options.server_name, > request_queue_size=options.request_queue_size, > timeout=options.timeout, > shutdown_timeout=options.shutdown_timeout, > path=options.folder) > try: > self.server.start() > except: > #self.server.stop() > self.server = None > raise > > def stop(self): > self.log("web2py server stopping") > if not self.chdir(): return > if self.server: > self.server.stop() > time.sleep(1) > > def web2py_windows_service_handler(argv=None, opt_file='options'): > path = os.path.dirname(__file__) > classstring = os.path.normpath(os.path.join(up(path), > 'gluon.winservice.Web2pyService')) > if opt_file: > Web2pyService._exe_args_ = opt_file > win32serviceutil.HandleCommandLine(Web2pyService, > serviceClassString=classstring,argv=['', 'install']) > win32serviceutil.HandleCommandLine(Web2pyService, > serviceClassString=classstring,argv=argv) > > if __name__=='__main__': > web2py_windows_service_handler() --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---