Unable to start AMS Acomba Connector on Windows
Question: I am trying to get a python service to run under Windows 7 however I am unable
to start it.

I have started by installing the service using

    
    
    c:\amsconnector>amsconnector.py --username domain\admin --password ************ install
    Installing service AMS Acomba Connector
    Service installed
    

After that, I run

    
    
    c:\amsconnector>amsconnector.py start
    Starting service AMS Acomba Connector
    

When I check the running services list, I notice that the service is not
running and when checking the event log, I am presented with this stacktrace

    
    
    Python could not import the service's module 
    Traceback (most recent call last):
      File "C:\amsconnector\amsconnector.py", line 343, in <module>
    win32serviceutil.HandleCommandLine(AMSConnectorService)
      File "C:\Python27\lib\site-packages\win32\lib\win32serviceutil.py", line 521, in HandleCommandLine
    usage()
      File "C:\Python27\lib\site-packages\win32\lib\win32serviceutil.py", line 505, in usage
    sys.exit(1)
    SystemExit: 1 
    %2: %3
    

The line 343 of amsconnector.py looks like this

    
    
    if True or __name__ == '__main__':
        win32serviceutil.HandleCommandLine(AMSConnectorService)
    

After checking out the source code of win32serviceutil.py, it appears that the
service is just printing out the win32service usage dialog instead of actually
running the python class. I am completely confused!


Answer: Thanks roeland!

I was able to fix the issue by simply removing the "True or" part of the last
line leaving it like this:

    
    
    if True or __name__ == '__main__':
        win32serviceutil.HandleCommandLine(AMSConnectorService)
    

