473,383 Members | 1,788 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Run as service

Hello,
i´m starting with python and i made this little piece of code, to know
if i have new mails to receive.

import poplib, getpass
arquivo = 'mails.txt'
info = file(arquivo).read().split('\n')
d = {}
for e in info:
a = e.split('\t')
print "Verificando e-mail de %s" % (a[1],)
p = poplib.POP3(a[0])
p.user(a[1])
p.pass_(getpass.getpass())
print "\n%s mensagens em seu mailbox.\n" % p.stat()[0]
p = None
print "Final"
it gets some information from mails.txt* file and watch new mails. I
want to know how to leave this code running as service under windows and
send a warning message (like that windows popup messages) when a there
is a new e-mail.

* my file is like this (simple text)
mailserver \t maillogin \n

Tkz and sorry about my english....

--
André
Jul 18 '05 #1
1 1185
You should probably get your hands on Mark Hammond's,
excellent book, Python Programming on Win32. It
has a very good section on writing services. I'm not
sure you want this to run as a service.

Also take a look at Sam Rushing's site. There is an
example of a POP3 mailbox system-tray app. Should
be a good example to work from. It may already to
what you want.

HTH,
Larry Bates
Syscon, Inc.

"André Nobre" <an***@andrenobre.com.br> wrote in message
news:ma*************************************@pytho n.org...
Hello,
i´m starting with python and i made this little piece of code, to know
if i have new mails to receive.

import poplib, getpass
arquivo = 'mails.txt'
info = file(arquivo).read().split('\n')
d = {}
for e in info:
a = e.split('\t')
print "Verificando e-mail de %s" % (a[1],)
p = poplib.POP3(a[0])
p.user(a[1])
p.pass_(getpass.getpass())
print "\n%s mensagens em seu mailbox.\n" % p.stat()[0]
p = None
print "Final"
it gets some information from mails.txt* file and watch new mails. I
want to know how to leave this code running as service under windows and
send a warning message (like that windows popup messages) when a there
is a new e-mail.

* my file is like this (simple text)
mailserver \t maillogin \n

Tkz and sorry about my english....

--
André

Jul 18 '05 #2

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

Similar topics

9
by: Hardy Wang | last post by:
Hi all: I read an article from http://www.c-sharpcorner.com/Code/2003/Sept/InstallingWinServiceProgrammatically.asp about how to install a windows service programmatically. Based ont the code...
7
by: Mike | last post by:
I want to create a windows service that will monitor another window service. what i need for the service to do is, if a service is stopped I need it to start the service back up example: ...
9
by: SP | last post by:
Hi All, I wrote a windows service which is supposed to stop after specified amount of time. I am calling OnStop() after specified time. OnStop() methods executed but I dont see the service...
3
by: Jeremy S. | last post by:
On my dev machine (XP/Pro with VS.NET 2003) I have been developing a Windows Service and installing it on the local machine by opening the Visual Studio Command Prompt and then executing . Now I...
2
by: letibal | last post by:
Hello, I have written a windows service and created an installer for it. The service runs under the system accounts. When started, it launches a GUI. By default, the InteractiveProcess property...
4
by: kkt49 | last post by:
# vim: et sw=4 ts=8 sts from wxPython.wx import * import sys, os, time import pywintypes import win32serviceutil import win32service import win32event import win32process
4
by: carson | last post by:
I have written two windows services: - service A does some crunching of local data files and uploads them to a central processing computer via http. - service B monitors a manifest file on a...
3
dmjpro
by: dmjpro | last post by:
plz send me a good link which can clearify me how the J2EE framework works i want the details information .... plz help thanx
20
by: =?Utf-8?B?cmtibmFpcg==?= | last post by:
I was executing the steps given in http://suppor.microsoft.com/kb/308359 for testing a sample web service application. However, the following line gives a compilation error: localhost.Service1...
5
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?...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.