Python 3.5 amd64 and win32service

Nagy László Zsolt gandalf at shopzeus.com
Thu Oct 6 01:23:01 EDT 2016




> On Wed, Oct 5, 2016 at 7:43 AM, Nagy László Zsolt <gandalf at shopzeus.com> wrote:
>> It did not help. I still get the same error message (service did not
>> respond in time).
> Can you run the service executable directly? From the command line
> check `sc qc TestService`. Run the BINARY_PATH_NAME executable, e.g.
>
>     for /f "tokens=1* delims=: " %i in (
>     'sc qc TestService ^| findstr BINARY_PATH_NAME') do @%j
>
> output:
>
>     C - Python Service Manager
>     Options:
>      -register - register the EXE - this should generally not be necessary.
>      -debug servicename [parms] - debug the Python service.
>
>     NOTE: You do not start the service using this program - start the
>     service using Control Panel, or 'net start service_name'
All of the commands below were executed in cmd.exe running in elevated
mode (as administrator):

c:\Users\Laci\Python\Projects\gateway>service_test.py install
Installing service TestService
Service installed

c:\Users\Laci\Python\Projects\gateway>sc qc TestService
[SC] QueryServiceConfig SUCCESS

SERVICE_NAME: TestService
        TYPE               : 10  WIN32_OWN_PROCESS
        START_TYPE         : 3   DEMAND_START
        ERROR_CONTROL      : 1   NORMAL
        BINARY_PATH_NAME   :
"C:\Users\Laci\AppData\Local\Programs\Python\Python35\lib\site-packages\win32\PythonService.exe"
        LOAD_ORDER_GROUP   :
        TAG                : 0
        DISPLAY_NAME       : Test Service
        DEPENDENCIES       :
        SERVICE_START_NAME : LocalSystem



It seems to be the correct executable:

c:\Users\Laci\Python\Projects\gateway>py -3
Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:18:55) [MSC v.1900 64
bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.executable
'C:\\Users\\Laci\\AppData\\Local\\Programs\\Python\\Python35\\python.exe'

The service starts to fail in any way:

* service_test.py start
* net start testservice
* from the services.msc with the start button

The error message suggest that the service does not respont to the start
request.

The MWE I provided is so simple. By now, It should be obvious what is
missing from it. :-(





More information about the Python-list mailing list