A daemon to download xml file and to parse it and extract some links from it. That is not something difficult or something new but it happens to be my first script in Python. Programming in python turned out to be really interesting. Amazed to see the availablity of packages in python. I have heard people saying that Python is far more better than java. I dont have enough expertise in both the languages but python looks easy to me when compared to java. Looking forward to do something good in python. So for those who want to create a daemon in python, it is simple. Everything is available in the os package. It is similar to C, a fork and a exit.
try:
pid = os.fork()
except OSError, e:
"""raise exception"""
if (pid == 0):
"""operations"""
else:
os._exit(0)
That is all u need to create a daemon. I used the sched package to schedule the download of rss file repeatedly after some time interval and xml.dom.minidom to parse the file after it is downloaded. All took just some ten lines of code. Python rocks :)
4 comments:
Can I have the code ?
Sure will give you.. Contact me in college when u are free
hey try out sax man its not standard as dom,but has little memory considerations.I wrote a simillar thing to parse xml files from thefreeword dictionary.can put it in tcenet one day?
thank you for info! i'll try write daemon on python
Post a Comment