Update of /cvsroot/pywin32/pywin32/win32/Lib
In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv28610/win32/Lib
Modified Files:
win32evtlogutil.py win32serviceutil.py
Log Message:
Move to exception attributes
Index: win32serviceutil.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/Lib/win32serviceutil.py,v
retrieving revision 1.30
retrieving revision 1.31
diff -C2 -d -r1.30 -r1.31
*** win32serviceutil.py 27 Nov 2008 05:58:17 -0000 1.30
--- win32serviceutil.py 11 Dec 2008 05:13:07 -0000 1.31
***************
*** 354,360 ****
try:
status = win32service.ControlService(hs, win32service.SERVICE_CONTROL_STOP)
! except pywintypes.error, (hr, name, msg):
! if hr!=winerror.ERROR_SERVICE_NOT_ACTIVE:
! raise win32service.error(hr, name, msg)
for i in range(waitSecs):
status = win32service.QueryServiceStatus(hs)
--- 354,360 ----
try:
status = win32service.ControlService(hs, win32service.SERVICE_CONTROL_STOP)
! except pywintypes.error, exc:
! if exc.winerror!=winerror.ERROR_SERVICE_NOT_ACTIVE:
! raise
for i in range(waitSecs):
status = win32service.QueryServiceStatus(hs)
***************
*** 407,414 ****
try:
StopService(serviceName, machine)
! except pywintypes.error, (hr, name, msg):
# Allow only "service not running" error
! if hr!=winerror.ERROR_SERVICE_NOT_ACTIVE:
! raise win32service.error(hr, name, msg)
# Give it a few goes, as the service may take time to stop
for i in range(waitSeconds):
--- 407,414 ----
try:
StopService(serviceName, machine)
! except pywintypes.error, exc:
# Allow only "service not running" error
! if exc.winerror!=winerror.ERROR_SERVICE_NOT_ACTIVE:
! raise
# Give it a few goes, as the service may take time to stop
for i in range(waitSeconds):
***************
*** 416,421 ****
StartService(serviceName, args, machine)
break
! except pywintypes.error, (hr, name, msg):
! if hr!=winerror.ERROR_SERVICE_ALREADY_RUNNING:
raise
win32api.Sleep(1000)
--- 416,421 ----
StartService(serviceName, args, machine)
break
! except pywintypes.error, exc:
! if exc.winerror!=winerror.ERROR_SERVICE_ALREADY_RUNNING:
raise
win32api.Sleep(1000)
***************
*** 573,578 ****
if waitSecs:
WaitForServiceStatus(serviceName, win32service.SERVICE_RUNNING, waitSecs)
! except win32service.error, (hr, fn, msg):
! print "Error starting service: %s" % msg
elif arg=="restart":
--- 573,578 ----
if waitSecs:
WaitForServiceStatus(serviceName, win32service.SERVICE_RUNNING, waitSecs)
! except win32service.error, exc:
! print "Error starting service: %s" % exc.strerror
elif arg=="restart":
***************
*** 639,647 ****
customOptionHandler(*(opts,))
print "Service installed"
! except win32service.error, (hr, fn, msg):
! if hr==winerror.ERROR_SERVICE_EXISTS:
arg = "update" # Fall through to the "update" param!
else:
! print "Error installing service: %s (%d)" % (msg, hr)
err = hr
except ValueError, msg: # Can be raised by custom option handler.
--- 639,647 ----
customOptionHandler(*(opts,))
print "Service installed"
! except win32service.error, exc:
! if exc.winerror==winerror.ERROR_SERVICE_EXISTS:
arg = "update" # Fall through to the "update" param!
else:
! print "Error installing service: %s (%d)" % (exc.strerror, exc.winerror)
err = hr
except ValueError, msg: # Can be raised by custom option handler.
***************
*** 682,687 ****
customOptionHandler(*(opts,))
print "Service updated"
! except win32service.error, (hr, fn, msg):
! print "Error changing service configuration: %s (%d)" % (msg,hr)
err = hr
--- 682,687 ----
customOptionHandler(*(opts,))
print "Service updated"
! except win32service.error, exc:
! print "Error changing service configuration: %s (%d)" % (exc.strerror,exc.winerror)
err = hr
***************
*** 692,697 ****
RemoveService(serviceName)
print "Service removed"
! except win32service.error, (hr, fn, msg):
! print "Error removing service: %s (%d)" % (msg,hr)
err = hr
elif arg=="stop":
--- 692,697 ----
RemoveService(serviceName)
print "Service removed"
! except win32service.error, exc:
! print "Error removing service: %s (%d)" % (exc.strerror,exc.winerror)
err = hr
elif arg=="stop":
***************
*** 703,708 ****
else:
StopService(serviceName)
! except win32service.error, (hr, fn, msg):
! print "Error stopping service: %s (%d)" % (msg,hr)
err = hr
if not knownArg:
--- 703,708 ----
else:
StopService(serviceName)
! except win32service.error, exc:
! print "Error stopping service: %s (%d)" % (exc.strerror,exc.winerror)
err = hr
if not knownArg:
Index: win32evtlogutil.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/Lib/win32evtlogutil.py,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** win32evtlogutil.py 27 Nov 2008 05:58:17 -0000 1.11
--- win32evtlogutil.py 11 Dec 2008 05:13:07 -0000 1.12
***************
*** 60,65 ****
win32api.RegDeleteKey(win32con.HKEY_LOCAL_MACHINE, \
"SYSTEM\\CurrentControlSet\\Services\\EventLog\\%s\\%s" % (eventLogType, appName))
! except win32api.error, (hr, fn, desc):
! if hr != winerror.ERROR_FILE_NOT_FOUND:
raise
--- 60,65 ----
win32api.RegDeleteKey(win32con.HKEY_LOCAL_MACHINE, \
"SYSTEM\\CurrentControlSet\\Services\\EventLog\\%s\\%s" % (eventLogType, appName))
! except win32api.error, exc:
! if exc.winerror != winerror.ERROR_FILE_NOT_FOUND:
raise
|