Note that there are some explanatory texts on larger screens.

plurals
  1. POInstalling and Starting a CherryPy server script as Windows service (using sc.exe)
    primarykey
    data
    text
    <p>I am trying to install and start a simple <em>CherryPy</em> server as a Windows service.</p> <p>Here is the script: (Removed some lines to cut it short. It's fully working when executing manually from the command-line)</p> <pre><code>app = AdminMediaHandler(django.core.handlers.wsgi.WSGIHandler()) logged_app = TransLogger(app) server = wsgiserver.CherryPyWSGIServer( ('127.0.0.1', 8632), logged_app, server_name='localhost', numthreads=20 ) try: server.start() except KeyboardInterrupt: server.stop() </code></pre> <p>I'm using <code>sc.exe</code> to install and start the service. Installation goes fine, but I can't seem to start the service.</p> <p>The command used is: (note there're spaces in the paths, though I'm handeling this with double-quotes, and the <code>binPath</code> is working when executing its string manually through the command-line)</p> <pre><code>&gt; sc.exe create "ServiceName" binPath= "\"C:\Path to Python\python.exe\" \"C:\Path to CherryPy Script\cherryserver.py\"" &gt; sc.exe start "ServiceName" </code></pre> <p>I keep getting this error, no matter if attempting to start the service using <code>sc.exe</code> or through <code>services.msc</code> GUI:</p> <pre><code>[SC] StartService FAILED 1053: The service did not respond to the start or control request in a timely fashion. </code></pre> <p>From what I understand, this is happenning because <code>python.exe</code> doesn't implement the Windows Service API.</p> <p>I do not wish to create an <code>.exe</code> from the script, using <em>py2exe</em>.</p> <p>I have found <a href="https://stackoverflow.com/questions/1423345/can-i-run-a-python-script-as-a-service/1423369#1423369">this answer</a> that suggests to install the service using different tools than <code>sc.exe</code>, called <code>srvany.exe</code> &amp; <code>instsrv.exe</code>. However, I can't find them in the <a href="http://www.google.co.il/search?sourceid=chrome&amp;ie=UTF-8&amp;q=win2k%20resource%20kit" rel="nofollow noreferrer">Win2K Resource Kit website</a>.</p> <p>Does anybody know how to install &amp; start this <code>.py</code> as a Windows succesfully?</p> <p>Does anybody know </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload