Re: PythonService was unable to locate the service manager

Jacob Nolan via python-win32 <[email protected]> Thu, 18 Jan 2024 06:19:26 +0000
Newsgroups gmane.comp.python.windows
Message-ID <0108018d1b397434-381b8d04-812e-4b46-ba7c-59c334a28365-000000@ap-southeast-2.amazonses.com>
This is a multi-part message in MIME format.
--===============2094129188517133479==
Content-Type: multipart/alternative;
 boundary="------------k95kDfQ86U6AuCFS13IFz8BT"
Content-Language: en-US

This is a multi-part message in MIME format.
--------------k95kDfQ86U6AuCFS13IFz8BT
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

E: is just a local harddrive. The full python install and files under 
the E: drive is accessible for both the local SYSTEM user, my user and 
administrator.

It is configured to run as the Local System Account.


I am successfully able to install the service initially via admin 
command prompt, and the run it via pywin service debug or using 
services.msc. But after performing several more service installs I then 
get this error. It regularly happens and stops any further services from 
running.

I can then reinstall python and it is resolved again.


I've asked IT to review any antivirus blocking of files/manipulation of 
files. They have confirmed there is not. Although I was going to perform 
checksums on the DLL's and pythonservice.exe.


*Jacob Nolan*
*Gayner Technical Services*
Phone: 0437210168
Email: [email protected]
On 1/13/24 02:05, Mark Hammond wrote:
> On 2024-01-11 5:46 p.m., Jacob Nolan via python-win32 wrote:
>>
>> I performed a custom install for all users on my E: drive 
>> (E:/installs/python3). Added it to the path. It is not under my 
>> specific user account. My understanding is this is a global install.
>>
> What exactly is E:? If anything other than a local device it might not 
> be available to the user running the service.
>>
>> I then run it under administrator privileged cmd and successfully 
>> install the service.
>>
>> Looking at security permissions for pythonservice.exe in the root 
>> python directory. SYSTEM and Admin users have full control.
>>
> To be clear, the entire Python tree will need those permissions, not 
> just that .exe. And the question is whether the user running the 
> service has access - SYSTEM and Admin should cover many common 
> scenarios, but not all. You could try configuring the service for your 
> specific user just to see if it works - if it does it would still 
> point to user permissions.
>
> Mark
>
>
>
>>
>> *Jacob Nolan*
>> *Gayner Technical Services*
>> Phone: 0437210168
>> Email: [email protected]
>> On 1/12/24 01:19, Mark Hammond wrote:
>>>
>>> The "<Error getting traceback - traceback.print_exception() failed>" 
>>> part sounds like it is failing to find Python itself. Where is 
>>> Python installed? Is it possible the user running the service can't 
>>> access that location? I believe Python being installed in the 
>>> default location could cause this if the server is running as any 
>>> other other than the user which installed Python.
>>>
>>> Mark
>>>
>>>
>>> On 2024-01-11 1:20 a.m., Jacob Nolan via python-win32 wrote:
>>>>
>>>> Currently experiencing this issue on my Windows machine when 
>>>> installing a Windows Service. This is the error output I get from 
>>>> running in the cmd as administrator. Restricting me from being able 
>>>> to run my services.
>>>>
>>>> *- PythonService was unable to locate the service manager. Please 
>>>> see the event log for details.**
>>>> *
>>>>
>>>>
>>>> Here is the output from event viewer application log:
>>>>
>>>> |The description for Event ID 14 from source Python Service cannot 
>>>> be found. Either the component that raises this event is not 
>>>> installed on your local computer or the installation is corrupted. 
>>>> You can install or repair the component on the local computer. If 
>>>> the event originated on another computer, the display information 
>>>> had to be saved with the event. The following information was 
>>>> included with the event: <Error getting traceback - 
>>>> traceback.print_exception() failed> The specified resource type 
>>>> cannot be found in the image file |
>>>>
>>>>
>>>> This issue has happened on each of these version I've tested 
>>>> Python3.11, 3.10.10 and 3.10.8.
>>>>
>>>> Currently running Python 3.10.8 64 Bit on Windows Server 2016.
>>>>
>>>> - I've installed pywin32
>>>>
>>>> - Run post_install in the root directory of python310
>>>>
>>>> - Installed the service with install flag
>>>>
>>>> - Attempted to start service with start flag
>>>>
>>>> - PythonService was unable to locate the service manager. Please 
>>>> see the event log for details.
>>>>
>>>> -- 
>>>> *Thanks*
>>>> *Jacob*
>>>>
>>>> _______________________________________________
>>>> python-win32 mailing list
>>>> [email protected]
>>>> https://mail.python.org/mailman/listinfo/python-win32
>>
>> _______________________________________________
>> python-win32 mailing list
>> [email protected]
>> https://mail.python.org/mailman/listinfo/python-win32
--------------k95kDfQ86U6AuCFS13IFz8BT
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 7bit

<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>E: is just a local harddrive. The full python install and files
      under the E: drive is accessible for both the local SYSTEM user,
      my user and administrator.</p>
    <p>It is configured to run as the Local System Account.<br>
    </p>
    <p><br>
    </p>
    <p>I am successfully able to install the service initially via admin
      command prompt, and the run it via pywin service debug or using
      services.msc. But after performing several more service installs I
      then get this error. It regularly happens and stops any further
      services from running.<br>
    </p>
    <p>I can then reinstall python and it is resolved again.<br>
    </p>
    <p><br>
    </p>
    <p>I've asked IT to review any antivirus blocking of
      files/manipulation of files. They have confirmed there is not.
      Although I was going to perform checksums on the DLL's and
      pythonservice.exe.<br>
    </p>
    <p><br>
    </p>
    <div class="moz-signature"><b>Jacob Nolan</b><br>
      <b>Gayner Technical Services</b><br>
      Phone: 0437210168<br>
      Email: <a class="moz-txt-link-abbreviated" href="mailto:[email protected]">[email protected]</a><br>
    </div>
    <div class="moz-cite-prefix">On 1/13/24 02:05, Mark Hammond wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:[email protected]">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <div class="moz-cite-prefix">On 2024-01-11 5:46 p.m., Jacob Nolan
        via python-win32 wrote:<br>
      </div>
      <blockquote type="cite"
cite="mid:0108018cfab4895e-6fbf4ae9-292a-4848-8b90-504eaea39ba3-000000@ap-southeast-2.amazonses.com">
        <meta http-equiv="Content-Type" content="text/html;
          charset=UTF-8">
        <p>I performed a custom install for all users on my E: drive
          (E:/installs/python3). Added it to the path. It is not under
          my specific user account. My understanding is this is a global
          install. <br>
        </p>
      </blockquote>
      What exactly is E:? If anything other than a local device it might
      not be available to the user running the service.<br>
      <blockquote type="cite"
cite="mid:0108018cfab4895e-6fbf4ae9-292a-4848-8b90-504eaea39ba3-000000@ap-southeast-2.amazonses.com">
        <p> </p>
        <p>I then run it under administrator privileged cmd and
          successfully install the service. <br>
        </p>
        <p>Looking at security permissions for pythonservice.exe in the
          root python directory. SYSTEM and Admin users have full
          control.<br>
        </p>
      </blockquote>
      <p>To be clear, the entire Python tree will need those
        permissions, not just that .exe. And the question is whether the
        user running the service has access - SYSTEM and Admin should
        cover many common scenarios, but not all. You could try
        configuring the service for your specific user just to see if it
        works - if it does it would still point to user permissions.<br>
      </p>
      <p>Mark</p>
      <p><br>
      </p>
      <p><br>
      </p>
      <blockquote type="cite"
cite="mid:0108018cfab4895e-6fbf4ae9-292a-4848-8b90-504eaea39ba3-000000@ap-southeast-2.amazonses.com">
        <p> </p>
        <p><br>
        </p>
        <div class="moz-signature"><b>Jacob Nolan</b><br>
          <b>Gayner Technical Services</b><br>
          Phone: 0437210168<br>
          Email: <a class="moz-txt-link-abbreviated
            moz-txt-link-freetext"
            href="mailto:[email protected]"
            moz-do-not-send="true">[email protected]</a><br>
        </div>
        <div class="moz-cite-prefix">On 1/12/24 01:19, Mark Hammond
          wrote:<br>
        </div>
        <blockquote type="cite"
          cite="mid:[email protected]">
          <meta http-equiv="Content-Type" content="text/html;
            charset=UTF-8">
          <p>The "&lt;Error getting traceback -
            traceback.print_exception() failed&gt;" part sounds like it
            is failing to find Python itself. Where is Python installed?
            Is it possible the user running the service can't access
            that location? I believe Python being installed in the
            default location could cause this if the server is running
            as any other other than the user which installed Python.<br>
          </p>
          <p>Mark<br>
          </p>
          <p><br>
          </p>
          <div class="moz-cite-prefix">On 2024-01-11 1:20 a.m., Jacob
            Nolan via python-win32 wrote:<br>
          </div>
          <blockquote type="cite"
cite="mid:0108018cf72db12a-bf384f9a-33b5-4858-8fa5-f2fd05da5cdb-000000@ap-southeast-2.amazonses.com">
            <meta http-equiv="content-type" content="text/html;
              charset=UTF-8">
            <p>Currently experiencing this issue on my Windows machine
              when installing a Windows Service. This is the error
              output I get from running in the cmd as administrator.
              Restricting me from being able to run my services.<br>
            </p>
            <p><b>- PythonService was unable to locate the service
                manager. Please see the event log for details.</b><b><br>
              </b></p>
            <p><br>
            </p>
            <p>Here is the output from event viewer application log:<br>
            </p>
            <pre><code id="code"><span>The description for Event ID 14 from source Python Service cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer.</span>
<span></span>
<span>If the event originated on another computer, the display information had to be saved with the event.</span>
<span></span>
<span>The following information was included with the event: </span>
<span></span>
<span>&lt;Error getting traceback - traceback.print_exception() failed&gt;</span>
<span></span>
<span>The specified resource type cannot be found in the image file</span>
</code></pre>
            <p><br>
            </p>
            <p>This issue has happened on each of these version I've
              tested Python3.11, 3.10.10 and 3.10.8.</p>
            <p>Currently running Python 3.10.8 64 Bit on Windows Server
              2016.</p>
            <p>- I've installed pywin32</p>
            <p>- Run post_install in the root directory of python310</p>
            <p>- Installed the service with install flag</p>
            <p>- Attempted to start service with start flag<br>
            </p>
            <p>- PythonService was unable to locate the service manager.
              Please see the event log for details.<br>
            </p>
            <div class="moz-signature">-- <br>
              <b>Thanks</b></div>
            <div class="moz-signature"><b>Jacob</b><br>
            </div>
            <br>
            <fieldset class="moz-mime-attachment-header"></fieldset>
            <pre class="moz-quote-pre" wrap="">_______________________________________________
python-win32 mailing list
<a class="moz-txt-link-abbreviated moz-txt-link-freetext" href="mailto:[email protected]" moz-do-not-send="true">[email protected]</a>
<a class="moz-txt-link-freetext" href="https://mail.python.org/mailman/listinfo/python-win32" moz-do-not-send="true">https://mail.python.org/mailman/listinfo/python-win32</a>
</pre>
          </blockquote>
        </blockquote>
        <br>
        <fieldset class="moz-mime-attachment-header"></fieldset>
        <pre class="moz-quote-pre" wrap="">_______________________________________________
python-win32 mailing list
<a class="moz-txt-link-abbreviated moz-txt-link-freetext" href="mailto:[email protected]" moz-do-not-send="true">[email protected]</a>
<a class="moz-txt-link-freetext" href="https://mail.python.org/mailman/listinfo/python-win32" moz-do-not-send="true">https://mail.python.org/mailman/listinfo/python-win32</a>
</pre>
      </blockquote>
    </blockquote>
  </body>
</html>

--------------k95kDfQ86U6AuCFS13IFz8BT--

--===============2094129188517133479==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
python-win32 mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-win32

--===============2094129188517133479==--