Creating a stand alone Python Service (win32) 
Author Message
 Creating a stand alone Python Service (win32)

Hi.

I want to use a python service I wrote as a stand alone service, meaning
that it should be possible to install the service on a client without having
to install Python first. As I did with other Python (non service)
applications before, I used py2exe to convert the service into a stand alone
application. This "stand alone" service runs fine on my development machine,
but it won't work on a computer without Python installed (respectively the
win32 extensions for Python), as it needs the PythonService.exe to be
registered on the client.

I tried to register the PythonService.exe on the client, but (after adding
the DLLs it needs) I got the following message when running
"PythonService.exe /register" (enclosed in *'s to separate it from the rest
of this message):

*********************************
Registering the Python Service Manager ...
'import site' failed; use -v for traceback
*********************************

Is there a way to get "PythonService.exe" to run on a client without
installing Python ?

If that is not possible, how could I change my service so that it doesn't
need PythonService.exe anymore ?

Thanks for your help in advance.

--
Cheers,

Mike.

PS: remove NOSPAM from my reply address to get my actual email address.



Thu, 06 Oct 2005 18:41:16 GMT  
 Creating a stand alone Python Service (win32)

Quote:

> I tried to register the PythonService.exe on the client, but (after adding
> the DLLs it needs) I got the following message when running
> "PythonService.exe /register" (enclosed in *'s to separate it from the rest
> of this message):

> *********************************
> Registering the Python Service Manager ...
> 'import site' failed; use -v for traceback
> *********************************

Are you certain that it didn't work anyway?  That message comes when
the python.exe (or your service?) is run in a context where it is
unable to find the file site.py.  It's just a warning though, not
a serious failure, unless something later depends on site.py
and its normal functioning.

(To see this in action, set PYTHONHOME somewhere incorrect, then
run python using the full path.)

If you want to make it go away, you might be able to include a
dummy site.py in your package, or perhaps somehow invoke the -S
option on startup, although to be honest I'm not sure how all
this interacts with py2exe so at this point I'm rambling....

-Peter



Thu, 06 Oct 2005 22:15:31 GMT  
 Creating a stand alone Python Service (win32)
Hi.

:: Are you certain that it didn't work anyway?  That message comes when
:: the python.exe (or your service?) is run in a context where it is
:: unable to find the file site.py.  It's just a warning though, not
:: a serious failure, unless something later depends on site.py
:: and its normal functioning.
::
:: (To see this in action, set PYTHONHOME somewhere incorrect, then
:: run python using the full path.)
::
:: If you want to make it go away, you might be able to include a
:: dummy site.py in your package, or perhaps somehow invoke the -S
:: option on startup, although to be honest I'm not sure how all
:: this interacts with py2exe so at this point I'm rambling....

You are right, it is working anyway.

I was trying to start the service with a batch file, but it seems that the
service created with py2exe can't be started with "<servicename> -start"
(py2exe allows "-install" and "-remove"), but even though it doesn't really
know the "start" option, it still says "... Starting service - this may take
several seconds - please wait ... Could not start the service - error 997".

That was what made me think that the service is not working and given the
message I got when registering PythonService.exe, I thought it was caused by
this.

After seeing your message, I tried again and used the Service Management
Console to start the service and everything worked just fine. I should have
use "net start <servicename>" in my batch file form the start. That would
have saved me a lot of trouble.

Thanks for pointing out that the message I got was simply a warning and I
appologize for not checking this properly before I asked this question in
the first place !

--
Cheers,

Mike.

PS: remove NOSPAM from my reply address to get my actual email address.



Sat, 08 Oct 2005 11:18:13 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. To stand-alone or not to stand-alone

2. How Do You Create Stand Alone Applications?

3. Creating a stand-alone exec???

4. Creating Stand Alone Applications With Oberon-2

5. creating stand-alone versions for easy distribution etc

6. Tkinter: easiest way to create stand-alone dialog?

7. Tclapp in windows: How to wrap a custom interpreter to create a stand-alone executable

8. How to create one stand alone executable??????

9. Stand-Alone Python Application

10. Stand-alone Python Apps?

11. running a stand-alone executable from within a python program

12. Newbie - Stand alone python

 

 
Powered by phpBB® Forum Software