Jason,
Thanks for you suggestion about config file to redirect output. It help
somewhat. I can run quixote.demo as a medusa service. Still there is one big
problem: When form or widget is submitted, it does nothing. Here is my new
program:
*****************************************************************
import win32serviceutil
import win32service
import win32event
class motorService(win32serviceutil.ServiceFramework):
_svc_name_ = "motorService"
_svc_display_name_ = "Motor Service"
def __init__(self, args):
win32serviceutil.ServiceFramework.__init__(self, args)
self.hWaitStop = win32event.CreateEvent(None, 0, 0, None)
def SvcStop(self):
self.ReportServiceStatus(win32service.SERVICE_STOP_PENDING)
win32event.SetEvent(self.hWaitStop)
def SvcDoRun(self):
import asyncore
from quixote.server.medusa_http import http_server, QuixoteHandler
from quixote import enable_ptl
from quixote.publish import Publisher
enable_ptl()
server = http_server.http_server('', 80)
publisher = Publisher('quixote.demo')
publisher.read_config("c:/demo.conf")
publisher.setup_logs()
dh = QuixoteHandler(publisher, 'quixote/demo', server)
server.install_handler(dh)
asyncore.loop()
win32event.WaitForSingleObject(self.hWaitStop, win32event.INFINITE)
if __name__=='__main__':
win32serviceutil.HandleCommandLine(motorService)
************************************************************
with demo.conf file:
DEBUG_LOG = "c:/quixote-demo-debug.log"
ERROR_LOG = "c:/quixote-demo-error.log"
DISPLAY_EXCEPTIONS = "plain"
SECURE_ERRORS = 0
*********************************************
and c:\quixote-demo-debug.log file:
debug message from the index page
error: Server Error: exceptions.IOError, [Errno 9] Bad file descriptor: file:
c:\python23\Lib\site-packages\medusa\logger.py line: 64
error: uncaptured python exception, closing channel
(exceptions.IOError:[Errno 9] Bad file descriptor
[C:\Python23\lib\asyncore.py|write|77]
[C:\Python23\lib\asyncore.py|handle_write_event|397]
[C:\Python23\lib\asynchat.py|handle_write|152]
[C:\Python23\lib\asynchat.py|initiate_send|213]
[C:\Python23\lib\asynchat.py|refill_buffer|200] [c:\python23\Lib\site-
packages\medusa\producers.py|more|179] [c:\python23\Lib\site-
packages\medusa\producers.py|more|206] [c:\python23\Lib\site-
packages\medusa\http_server.py|log|283] [c:\python23\Lib\site-
packages\medusa\logger.py|log|242] [c:\python23\Lib\site-
packages\medusa\logger.py|log|76] [c:\python23\Lib\site-
packages\medusa\logger.py|write|52] [c:\python23\Lib\site-
packages\medusa\logger.py|maybe_flush|64])
error: Server Error: exceptions.IOError, [Errno 9] Bad file descriptor: file:
c:\python23\Lib\site-packages\medusa\logger.py line: 64
error: uncaptured python exception, closing channel
(exceptions.IOError:[Errno 9] Bad file descriptor
[C:\Python23\lib\asyncore.py|write|77]
[C:\Python23\lib\asyncore.py|handle_write_event|397]
[C:\Python23\lib\asynchat.py|handle_write|152]
[C:\Python23\lib\asynchat.py|initiate_send|213]
[C:\Python23\lib\asynchat.py|refill_buffer|200] [c:\python23\Lib\site-
packages\medusa\producers.py|more|179] [c:\python23\Lib\site-
packages\medusa\producers.py|more|206] [c:\python23\Lib\site-
packages\medusa\http_server.py|log|283] [c:\python23\Lib\site-
packages\medusa\logger.py|log|242] [c:\python23\Lib\site-
packages\medusa\logger.py|log|76] [c:\python23\Lib\site-
packages\medusa\logger.py|write|52] [c:\python23\Lib\site-
packages\medusa\logger.py|maybe_flush|64])
error: uncaptured python exception, closing channel
(exceptions.IOError:[Errno 9] Bad file descriptor
[C:\Python23\lib\asyncore.py|read|69]
[C:\Python23\lib\asyncore.py|handle_read_event|390]
[C:\Python23\lib\asynchat.py|handle_read|118] [c:\python23\Lib\site-
packages\medusa\http_server.py|found_terminator|448] [c:\python23\Lib\site-
packages\medusa\http_server.py|found_terminator|150] [c:\python23\Lib\site-
packages\medusa\xmlrpc_handler.py|found_terminator|87] [c:\python23\Lib\site-
packages\quixote\server\medusa_http.py|continue_request|128] [c:\python23\Lib
\site-packages\medusa\http_server.py|done|250]
[C:\Python23\lib\asynchat.py|push_with_producer|163]
[C:\Python23\lib\asynchat.py|initiate_send|213]
[C:\Python23\lib\asynchat.py|refill_buffer|200] [c:\python23\Lib\site-
packages\medusa\producers.py|more|179] [c:\python23\Lib\site-
packages\medusa\producers.py|more|206] [c:\python23\Lib\site-
packages\medusa\http_server.py|log|283] [c:\python23\Lib\site-
packages\medusa\logger.py|log|242] [c:\python23\Lib\site-
packages\medusa\logger.py|log|76] [c:\python23\Lib\site-
packages\medusa\logger.py|write|52] [c:\python23\Lib\site-
packages\medusa\logger.py|maybe_flush|64])
error: Server Error: exceptions.IOError, [Errno 9] Bad file descriptor: file:
c:\python23\Lib\site-packages\medusa\logger.py line: 64
error: uncaptured python exception, closing channel
(exceptions.IOError:[Errno 9] Bad file descriptor
[C:\Python23\lib\asyncore.py|write|77]
[C:\Python23\lib\asyncore.py|handle_write_event|397]
[C:\Python23\lib\asynchat.py|handle_write|152]
[C:\Python23\lib\asynchat.py|initiate_send|213]
[C:\Python23\lib\asynchat.py|refill_buffer|200] [c:\python23\Lib\site-
packages\medusa\producers.py|more|179] [c:\python23\Lib\site-
packages\medusa\producers.py|more|206] [c:\python23\Lib\site-
packages\medusa\http_server.py|log|283] [c:\python23\Lib\site-
packages\medusa\logger.py|log|242] [c:\python23\Lib\site-
packages\medusa\logger.py|log|76] [c:\python23\Lib\site-
packages\medusa\logger.py|write|52] [c:\python23\Lib\site-
packages\medusa\logger.py|maybe_flush|64])
error: uncaptured python exception, closing channel
(exceptions.IOError:[Errno 9] Bad file descriptor
[C:\Python23\lib\asyncore.py|read|69]
[C:\Python23\lib\asyncore.py|handle_read_event|390]
[C:\Python23\lib\asynchat.py|handle_read|118] [c:\python23\Lib\site-
packages\medusa\http_server.py|found_terminator|448] [c:\python23\Lib\site-
packages\medusa\http_server.py|found_terminator|150] [c:\python23\Lib\site-
packages\medusa\xmlrpc_handler.py|found_terminator|87] [c:\python23\Lib\site-
packages\quixote\server\medusa_http.py|continue_request|128] [c:\python23\Lib
\site-packages\medusa\http_server.py|done|250]
[C:\Python23\lib\asynchat.py|push_with_producer|163]
[C:\Python23\lib\asynchat.py|initiate_send|213]
[C:\Python23\lib\asynchat.py|refill_buffer|200] [c:\python23\Lib\site-
packages\medusa\producers.py|more|179] [c:\python23\Lib\site-
packages\medusa\producers.py|more|206] [c:\python23\Lib\site-
packages\medusa\http_server.py|log|283] [c:\python23\Lib\site-
packages\medusa\logger.py|log|242] [c:\python23\Lib\site-
packages\medusa\logger.py|log|76] [c:\python23\Lib\site-
packages\medusa\logger.py|write|52] [c:\python23\Lib\site-
packages\medusa\logger.py|maybe_flush|64])
error: Server Error: exceptions.IOError, [Errno 9] Bad file descriptor: file:
c:\python23\Lib\site-packages\medusa\logger.py line: 64
error: uncaptured python exception, closing channel
(exceptions.IOError:[Errno 9] Bad file descriptor
[C:\Python23\lib\asyncore.py|write|77]
[C:\Python23\lib\asyncore.py|handle_write_event|397]
[C:\Python23\lib\asynchat.py|handle_write|152]
[C:\Python23\lib\asynchat.py|initiate_send|213]
[C:\Python23\lib\asynchat.py|refill_buffer|200] [c:\python23\Lib\site-
packages\medusa\producers.py|more|179] [c:\python23\Lib\site-
packages\medusa\producers.py|more|206] [c:\python23\Lib\site-
packages\medusa\http_server.py|log|283] [c:\python23\Lib\site-
packages\medusa\logger.py|log|242] [c:\python23\Lib\site-
packages\medusa\logger.py|log|76] [c:\python23\Lib\site-
packages\medusa\logger.py|write|52] [c:\python23\Lib\site-
packages\medusa\logger.py|maybe_flush|64])
error: Server Error: exceptions.IOError, [Errno 9] Bad file descriptor: file:
c:\python23\Lib\site-packages\medusa\logger.py line: 64
error: uncaptured python exception, closing channel
(exceptions.IOError:[Errno 9] Bad file descriptor
[C:\Python23\lib\asyncore.py|write|77]
[C:\Python23\lib\asyncore.py|handle_write_event|397]
[C:\Python23\lib\asynchat.py|handle_write|152]
[C:\Python23\lib\asynchat.py|initiate_send|213]
[C:\Python23\lib\asynchat.py|refill_buffer|200] [c:\python23\Lib\site-
packages\medusa\producers.py|more|179] [c:\python23\Lib\site-
packages\medusa\producers.py|more|206] [c:\python23\Lib\site-
packages\medusa\http_server.py|log|283] [c:\python23\Lib\site-
packages\medusa\logger.py|log|242] [c:\python23\Lib\site-
packages\medusa\logger.py|log|76] [c:\python23\Lib\site-
packages\medusa\logger.py|write|52] [c:\python23\Lib\site-
packages\medusa\logger.py|maybe_flush|64])
error: Server Error: exceptions.IOError, [Errno 9] Bad file descriptor: file:
c:\python23\Lib\site-packages\medusa\logger.py line: 64