Incorrect error message when attempting to debug a service that isn't...
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
Python 3.4
When attempting to run a service in debug mode without previously installing the service the following error message is received.
Traceback (most recent call last):
File "c:\Python34\lib\site-packages\win32\lib\win32serviceutil.py", line 620, in HandleCommandLine
exeName = LocateSpecificServiceExe(serviceName)
File "c:\Python34\lib\site-packages\win32\lib\win32serviceutil.py", line 86, in LocateSpecificServiceExe
hkey = win32api.RegOpenKey(win32con.HKEY_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Services\\%s" % (serviceName), 0, win32con.KEY_ALL_ACCESS)
pywintypes.error: (2, 'RegOpenKeyEx', 'The system cannot find the file specified.')
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "BuildService.py", line 76, in <module>
win32serviceutil.HandleCommandLine(AppServerSvcBase)
File "c:\Python34\lib\site-packages\win32\lib\win32serviceutil.py", line 622, in HandleCommandLine
if exc[0]== winerror.ERROR_FILE_NOT_FOUND:
TypeError: 'error' object does not support indexing
Where the following error message would be expected;
The service does not appear to be installed.
Please install the service before debugging it.
The following patch to win32/lib/win32serviceutil.py resolves the issue;
622c622
< if exc[0] == winerror.ERROR_FILE_NOT_FOUND:
---
> if exc.winerror == winerror.ERROR_FILE_NOT_FOUND:
My proposed patch
https://sourceforge.net/p/pywin32/patches/142/
is very similar.
Sorry, I meant
https://sourceforge.net/p/pywin32/patches/141/
Thanks, applied here:
http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=36371c35cf59
Could you, please, aplly also two my patches (#141 and #142)?
They are very simple and very similar -
a couple of lines
with indexing operator replaced by normal attribute access.