Python论坛  - 讨论区

标题:[python-chinese] 请教了:用win32service 来StartService出错

2006年11月16日 星期四 15:16

王明 mingwang在iflytek.com
星期四 十一月 16 15:16:46 HKT 2006

请指点一下:

我这么写但是报错,指点一下,谢谢!

import win32service

print "begin"
schSCManager = win32service.OpenSCManager( None, None,win32service.SC_MANAGER_ALL_ACCESS)

schService = win32service.OpenService(schSCManager, "alerter", win32service.SERVICE_ALL_ACCESS)

args = []
win32service.StartService(schService, args)

print "end"

报错:
Traceback (most recent call last):
  File "E:\pyxml_test\tst_service.py", line 8, in -toplevel-
    win32service.StartService(schService, args)
error: (1058, 'StartService', '\xce\xde\xb7\xa8\xc6\xf4\xb6\xaf\xb7\xfe\xce\xf1\xa3\xac\xd4\xad\xd2\xf2\xbf\xc9\xc4\xdc\xca\xc7\xd2\xd1\xb1\xbb\xbd\xfb\xd3\xc3\xbb\xf2\xd3\xeb\xc6\xe4\xcf\xe0\xb9\xd8\xc1\xaa\xb5\xc4\xc9\xe8\xb1\xb8\xc3\xbb\xd3\xd0\xc6\xf4\xb6\xaf\xa1\xa3')

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2006年11月16日 星期四 15:33

nmweizi nmweizi在163.com
星期四 十一月 16 15:33:59 HKT 2006

python-chinese£¬ÄãºÃ

ÔÚwin32serviceutil.pyÖÐÒѾ­¶¨ÒåºÃÁË¡£ÈçÏÂÖ±½Óµ÷ÓÃwin32serviceutil.StartService¾Í¿ÉÒÔÁË£¬ÎªÊ²Ã´»¹Òª×Ô¼ºÐ´£¿£¿£¿

def StartService(serviceName, args = None, machine = None):
    hscm = win32service.OpenSCManager(machine,None,win32service.SC_MANAGER_ALL_ACCESS)
    try:
        hs = SmartOpenService(hscm, serviceName, win32service.SERVICE_ALL_ACCESS)
        try:
            win32service.StartService(hs, args)
        finally:
            win32service.CloseServiceHandle(hs)
    finally:
        win32service.CloseServiceHandle(hscm)

nmweizi£¬nmweizi在163.com
2006-11-16 



----- Original Message ----- 
From: ÍõÃ÷ 
To: python-chinese 
Sent: 2006-11-16, 15:16:46
Subject: [python-chinese] Çë½ÌÁË£ºÓÃwin32service À´StartService³ö´í


ÇëÖ¸µãһϣº

ÎÒÕâô䵫ÊDZ¨´í£¬Ö¸µãһϣ¬Ð»Ð»£¡

import win32service

print "begin"
schSCManager = win32service.OpenSCManager( None, None,win32service.SC_MANAGER_ALL_ACCESS)

schService = win32service.OpenService(schSCManager, "alerter", win32service.SERVICE_ALL_ACCESS)

args = []
win32service.StartService(schService, args)

print "end"

±¨´í£º
Traceback (most recent call last):
  File "E:\pyxml_test\tst_service.py", line 8, in -toplevel-
    win32service.StartService(schService, args)
error: (1058, 'StartService', '\xce\xde\xb7\xa8\xc6\xf4\xb6\xaf\xb7\xfe\xce\xf1\xa3\xac\xd4\xad\xd2\xf2\xbf\xc9\xc4\xdc\xca\xc7\xd2\xd1\xb1\xbb\xbd\xfb\xd3\xc3\xbb\xf2\xd3\xeb\xc6\xe4\xcf\xe0\xb9\xd8\xc1\xaa\xb5\xc4\xc9\xe8\xb1\xb8\xc3\xbb\xd3\xd0\xc6\xf4\xb6\xaf\xa1\xa3')
_______________________________________________
python-chinese
Post: send python-chinese在lists.python.cn
Subscribe: send subscribe to python-chinese-request在lists.python.cn
Unsubscribe: send unsubscribe to python-chinese-request在lists.python.cn
Detail Info: http://python.cn/mailman/listinfo/python-chinese
-------------- 下一部分 --------------
Ò»¸öHTML¸½¼þ±»ÒƳý...
URL: http://python.cn/pipermail/python-chinese/attachments/20061116/17b5bdae/attachment.htm 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

如下红色区域有误,请重新填写。

    你的回复:

    请 登录 后回复。还没有在Zeuux哲思注册吗?现在 注册 !

    Zeuux © 2025

    京ICP备05028076号