Windows Services

M

Mondal

Hi,

Can anybody tell me how to develop Windows Services (which are actually
daemons) using Python. Also what protocol is most suitable for
developing a server-client application with the server running as a
Windows Service.

Thanks in advance

Bye
 
P

Peter Hansen

Mondal said:
Can anybody tell me how to develop Windows Services (which are actually
daemons) using Python.

Yes, anyone can tell you. Anyone who can use Google that is. Can you?

http://www.google.com/search?q=python+windows+service

(There are directly relevant answers on the first page of results.)
Also what protocol is most suitable for
developing a server-client application with the server running as a
Windows Service.

I'd suggest whatever protocol is most suitable for developing
client-server applications with the server *not* running as a Windows
Service. In other words, I don't think the manner in which the service
is invoked has much impact on the protocol you would use.

Generally the best protocol is determined more by what your server will
actually do, and performance requirements, than anything else.

-Peter
 
A

alf

Also think through which Windows account will run the service, and what
permissions it will need. A little up front work here will be
appreciated by the people who have to install your service.
 
M

Mondal

Hi,

Thanks to Peter, now I know how to control an *existing* Windows
service and how to run a *python script* as a Windows service. Although
these were really useful, my point was different.

I have developed a script that monitors a specified folder for changes
in the files or folders within it. I converted that script to a stand
alone exe using py2exe. ***Now I would like to run that exe as a
Windows service***.

I also intend to create an exe that will retrieve any information
stored by the file monitor mentioned above.

Please tell me how do I go about it.

Although I am a beginner in Python and Windows Services (Daemon), I am
a moderately experienced programmer.

-Regards
 
F

Frank Millman

Mondal said:
Hi,

Thanks to Peter, now I know how to control an *existing* Windows
service and how to run a *python script* as a Windows service. Although
these were really useful, my point was different.

I have developed a script that monitors a specified folder for changes
in the files or folders within it. I converted that script to a stand
alone exe using py2exe. ***Now I would like to run that exe as a
Windows service***.

I also intend to create an exe that will retrieve any information
stored by the file monitor mentioned above.

Please tell me how do I go about it.

Although I am a beginner in Python and Windows Services (Daemon), I am
a moderately experienced programmer.

-Regards

Here is an alternative solution.

I have a simple socket server program, which I wanted to run as a
service on Linux and Windows.

On Linux it was easy - start it from rc.local with a trailing &.

On Windows, I was given advice on how to use pywin32 to set up the
program as a Windows service, but it felt like overkill. Then someone
suggested 'srvany', a utility that allows you to run any program as a
service. It is part of the NT Resource Kit. I downloaded it and it
works fine for me. Google has plenty of references.

Frank Millman
 
S

Steve Holden

Mondal said:
Hi,

Thanks to Peter, now I know how to control an *existing* Windows
service and how to run a *python script* as a Windows service. Although
these were really useful, my point was different.

I have developed a script that monitors a specified folder for changes
in the files or folders within it. I converted that script to a stand
alone exe using py2exe. ***Now I would like to run that exe as a
Windows service***.

I also intend to create an exe that will retrieve any information
stored by the file monitor mentioned above.

Please tell me how do I go about it.

Although I am a beginner in Python and Windows Services (Daemon), I am
a moderately experienced programmer.
I'm afraid that you can't just run any old executable as a Windows service.

If something is going to be run as a service then it has to use the
Windows service API so it responds correctly to being started and
stopped, for example, and "pumps" the event queue from time to time.

regards
Steve
 
B

bonono

Steve said:
I'm afraid that you can't just run any old executable as a Windows service.

If something is going to be run as a service then it has to use the
Windows service API so it responds correctly to being started and
stopped, for example, and "pumps" the event queue from time to time.
I think there is some wrapper programs that can wrap around any console
window programs as service, either from cygwin or may be stand alone
too. Of course, the wrapped program would be stopped through some
"kill" signal rather than proper start/stop API calls.
 
M

Mondal

Hi,

Every one please accept my thanks.

I have stopped using Python IDLE. Know I am using Pythonwin IDE from
Active State. They have the same core modules. But the Pywin32
extensions are a plus from Active State.

The problem is that the Pywin32 Documentation is incomplete/incorrect.
The modules by Mark Hammond are in .pyd and not in .py. The
documentayion on Active's web site is also incorrect. Here is a code
snippet from the IDE

import win32serviceTraceback (most recent call last):

And here is the prototype from the documentation

win32service.CreateDesktop
PyHDESK = CreateDesktop()

Creates a new desktop in calling process's current window station

The documentation does not mention any arguments, yet there is a
TypeError.

The source code in C at Pywin32 extensions homepage are of not much
help.

So, how do i use win32 extensions?

Regards
 
R

Roger Upole

Active State's help file is missing parameters from some modules built using Swig.
The .chm included with the SourceForge releases has complete parameter info.

hth
Roger
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,565
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top