Menu

#140 Incorrect error message when attempting to debug a service that isn't installed. Python 3.4

Unstable (example)
closed-fixed
nobody
None
5
2015-08-24
2014-08-14
Horb
No

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:

Discussion

  • timur

    timur - 2015-03-24

    My proposed patch
    https://sourceforge.net/p/pywin32/patches/142/
    is very similar.

     
  • timur

    timur - 2015-03-24
     
  • Roger Upole

    Roger Upole - 2015-04-10
     
    • timur

      timur - 2015-04-10

      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.

       
  • Mark Hammond

    Mark Hammond - 2015-08-24
    • status: open --> closed-fixed
     

Log in to post a comment.