windows service problem

Discussion in 'Python' started by JackPhil, Oct 3, 2005.

  1. JackPhil

    JackPhil Guest

    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?
     
    JackPhil, Oct 3, 2005
    #1
    1. Advertising

  2. JackPhil

    fraca7 Guest

    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()
     
    fraca7, Oct 3, 2005
    #2
    1. Advertising

  3. JackPhil

    JackPhil Guest

    fraca7 wrote:
    >
    > 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.
     
    JackPhil, Oct 3, 2005
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?c2h5YW0=?=
    Replies:
    2
    Views:
    705
    =?Utf-8?B?c2h5YW0=?=
    May 22, 2006
  2. prowyh
    Replies:
    0
    Views:
    315
    prowyh
    Nov 16, 2007
  3. Billy Zhang
    Replies:
    7
    Views:
    1,263
    Steven Cheng [MSFT]
    Jul 31, 2008
  4. tshad

    Windows Service Service name

    tshad, Oct 14, 2009, in forum: ASP .Net
    Replies:
    1
    Views:
    409
    Mr. Arnold
    Oct 15, 2009
  5. Replies:
    1
    Views:
    236
    Joe Kaplan \(MVP - ADSI\)
    Jun 14, 2006
Loading...

Share This Page