解决python写的windows服务不能启动的问题

报“服务没有及时响应或控制请求”的错误,改用pyinstaller生成也是不行;查资料后修改setup.py如下即可,服务名、脚本名请自行替换:

代码如下:

#!/usr/bin/python #-*-coding:cp936-*-from distutils.core import setupimport 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’], cmdline_ #icon_resources=[(1, “cartrigde.ico”)] )

options = {“py2exe”: { “compressed”: 1, “bundle_files”: 1 } } setup( service=[myservice], options = options, zipfile = none, windows=[{“script”: “service.py”}], )

Posted in 未分类

发表评论