windows service problem

J

JackPhil

i code a very simple web server with python, and i want it should run
as service on WindowsXP.

the problem is i can run the service in debug mode, and it seems works
fine(i can connect the server with browser), but when i start the
service in the services control panel, i can't connect the server, the
server seems not start, and i can't stop the service.

any advice?
 
F

fraca7

JackPhil a écrit :
the problem is i can run the service in debug mode, and it seems works
fine(i can connect the server with browser), but when i start the
service in the services control panel, i can't connect the server, the
server seems not start, and i can't stop the service.

Make sure it doesn't output anything to stdout or stderr, I've run into
problems with that. I always include this kind of code in NT services:

class Devnull:
def write(self, bf):
pass
def close(self):
pass
def flush(self):
pass

sys.stdout = sys.stderr = Devnull()
 
J

JackPhil

fraca7 said:
Make sure it doesn't output anything to stdout or stderr, I've run into
problems with that. I always include this kind of code in NT services:

class Devnull:
def write(self, bf):
pass
def close(self):
pass
def flush(self):
pass

sys.stdout = sys.stderr = Devnull()

Thanks for your instructions. It's resolved my problem.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top