Reading then sending new parts of a log file

unayok unayok at gmail.com
Wed Jun 24 21:48:44 CEST 2009


On Jun 24, 10:23 am, Chuck Connors <don... at gmail.com> wrote:
> Hey guys.  I'm trying to work up a little program that will send any
> new lines written to a file (log file from my home automation
> software) to me via instant message.  I've gotten the instant message
> sending part figured out using xmpppy.
>
> I've done a few things with Python in the past but I am in no means
> more than a beginner/hacker.  Can someone tell me what commands/
> modules/etc exist for monitoring and parsing a file for new
> information that I can then send to my IM sending function?  I am not
> asking for anyone to write the code but merely a push in the right
> direction.

Here's a little nudge: http://code.activestate.com/recipes/157035/

In place of its "print" line, you'd make your call into your existing
code to send the message.

Some of the comments offer some improvements on it (always read the
comments on the recipes), but this is likely the direction you will
want to head.




More information about the Python-list mailing list