473,508 Members | 2,441 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Windows Services

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

Dec 14 '05 #1
9 4617
Mondal wrote:
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

Dec 14 '05 #2
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.

Dec 14 '05 #3
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

Dec 15 '05 #4

Mondal wrote:
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

Dec 15 '05 #5
Mondal wrote:
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

--
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC www.holdenweb.com
PyCon TX 2006 www.python.org/pycon/

Dec 15 '05 #6

Steve Holden wrote:
Mondal wrote:
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.

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.

Dec 15 '05 #7
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 win32service
ws=win32service
ws.CreateDesktop() Traceback (most recent call last):
File "<interactive input>", line 1, in ?
TypeError: CreateDesktop() takes exactly 4 arguments (0 given)


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

Dec 19 '05 #8
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
"Mondal" <ms******@gmail.com> wrote:
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 win32service
ws=win32service
ws.CreateDesktop() Traceback (most recent call last):
File "<interactive input>", line 1, in ?
TypeError: CreateDesktop() takes exactly 4 arguments (0 given)


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


----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Dec 19 '05 #9
Hi,

Thanks Upole!!!!!!! I dowloaded it. From exe files at sourceforge.net.

Regards

Dec 21 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2876
by: Stefan Hinz | last post by:
Degan, jumping in to try and solve some problems that look pretty obvious to me ... > #options for default service (mysqld2) > (mysqld2) It should be , not (mysqld2).
8
4164
by: Bill Sonia | last post by:
I've written a Windows Service to send e-mails on events like OnStart, OnStop, OnShutDown using System.Web.Mail. It works for everything but OnShutdown. My guess is that for OnShutDown, once my...
3
6128
by: illegal.prime | last post by:
Hi all, I have a service that needs to start a regular windows application. I'm running the service as ServiceAccount.LocalSystem. But, when it starts the process (using Process.Start) the GUI...
5
2284
by: =?Utf-8?B?dmlzaHJ1dGg=?= | last post by:
This code works fine in Windows Application. In Windows Application, I am able to zip the image files properly and it totally contains 900MB My problem is the same code which I used in my Windows...
2
4459
by: =?Utf-8?B?dmlzaHJ1dGg=?= | last post by:
Hi, I have 2 applications running, one Windows application project and the other windows services project. I want to call my Windows application in my windows services. I want to run them as...
1
4827
by: =?Utf-8?B?dmlzaHJ1dGg=?= | last post by:
Hi, I have 2 applications running, one Windows application project and the other windows services project. I want to call my Windows application in my windows services. I want to run them as...
5
3270
by: dm3281 | last post by:
I'm really starting to hate writing services -- or trying to, anyway. Why do I need to rename my project to the service name? Why do I need to set the "ServiceName" property to my service name?...
0
6101
AmberJain
by: AmberJain | last post by:
Windows Autorun FAQs: Overview NOTE- This complete article on "Windows Autorun FAQs" applies theoretically to all Windows NT-based OSes till Windows Vista (and probably Vista's successors too)....
0
30177
AmberJain
by: AmberJain | last post by:
Windows Autorun FAQs: List of autostart locations Linked from the Original article- "Windows Autorun FAQs: Description". Que: Can you list all the autostart locations for windows? Ans: Here is...
0
7114
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7321
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7377
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7034
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5623
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3191
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1544
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
762
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
412
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.