3

When using any version of servicemanager with Python 3.6.6 I get AttributeError: module 'servicemanager' has no attribute 'Initialize'*

Code Snippet:

if __name__ == '__main__':
    if len(sys.argv) == 1:
        servicemanager.Initialize()
        servicemanager.PrepareToHostSingle(RelayService3)
        servicemanager.StartServiceCtrlDispatcher()
    else:
        win32serviceutil.HandleCommandLine(RelayService3)

This seems to be the standard main function of any windows service written in python.

Any help would be greatly appreciated!

1 Answers1

3

I think install servicemanager for error:

\Python38-32\Scripts\pip3 uninstall servicemanager

After it works.

Massimo
  • 31
  • 2
  • 2
    It looks like pywin32 provides servicemanager, and installing the standalone library conflicts with that version. Uninstalling servicemanager 2.0.10 worked for me. – Zobal Sep 28 '22 at 13:13