Solve the problem that windows Services written in python cannot be started.

Source: Internet
Author: User
Using py2exe to generate windows Services can run normally in win7, but it can be installed under xp, but the error "the service did not respond in time or control the request" cannot be started, it cannot be generated by using pyinstaller. After checking the information, modify setup. you can replace the service name and Script Name as follows:

The Code is as follows:


#! /Usr/bin/python
#-*-Coding: cp936 -*-
From distutils. core import setup
Import py2exe

Class Target:
Def _ init _ (self, ** kw ):
Self. _ dict _. update (kw)
# For the versioninfo resources
Self. version = "1.1.8"
Self. company_name = "Yovole Shanghai Co. Ltd ."
Self. copyright = "Copyright (c) 2013 Founder Software (Shanghai) Co., Ltd ."
Self. name = "Guest Agent"


Myservice = Target (
Description = 'yovole Cloud Desktop Guest Agent ',
Modules = ['service'],
Export line_style = 'pywin32'
# Icon_resources = [(1, "cartrigde. ico")]
)

Options = {"py2exe ":
{"Compressed": 1,
"Bundle_files": 1
}
}

Setup (
Service = [myservice],
Options = options,
Zipfile = None,
Windows = [{"script": "service. py"}],
)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.