file parsing/watching + qt

Discussion in 'Python' started by aljosa, May 4, 2005.

  1. aljosa

    aljosa Guest

    this is a Qt app. app should watch for changes in /var/log/isdn.log and
    on file change (like new line was added to isdn.log) it should activate
    event in my app.

    i'm trying to fetch last line in file whenever isdnlog logs something
    so that i can parse that line for a number and store it somewhere else,
    is there a standard solution for this?

    i'm using python2.3 on linux with PyQt3.


    Aljosa
     
    aljosa, May 4, 2005
    #1
    1. Advertising

  2. > this is a Qt app. app should watch for changes in /var/log/isdn.log and
    > on file change (like new line was added to isdn.log) it should activate
    > event in my app.
    >
    > i'm trying to fetch last line in file whenever isdnlog logs something
    > so that i can parse that line for a number and store it somewhere else,
    > is there a standard solution for this?
    >
    > i'm using python2.3 on linux with PyQt3.


    This is UNIX/Linux specific, but one way would be to use QProcess to run
    "tail -f /var/log/isdn.log" and connect the readyReadStdout() signal to
    the Python callable that will handle the line.

    Phil
     
    Phil Thompson, May 4, 2005
    #2
    1. Advertising

  3. aljosa

    Swaroop C H Guest

    On 3 May 2005 22:43:02 -0700, aljosa <> wrote:
    > i'm trying to fetch last line in file whenever isdnlog logs something
    > so that i can parse that line for a number and store it somewhere else,
    > is there a standard solution for this?
    > i'm using python2.3 on linux with PyQt3.


    Use the Python binding to FAM (File Alteration Monitor):
    http://python-fam.sourceforge.net/


    HTH,
    --
    Swaroop C H
    Blog: http://www.swaroopch.info
    Book: http://www.byteofpython.info
     
    Swaroop C H, May 4, 2005
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Luis Esteban Valencia Muñoz
    Replies:
    3
    Views:
    1,448
    Scott Allen
    Jun 4, 2005
  2. Bomb Diggy
    Replies:
    11
    Views:
    6,231
    Ivan S Kirkpatrick
    Jul 3, 2003
  3. Benjamin D. LeMasurier

    watching a file

    Benjamin D. LeMasurier, Oct 1, 2004, in forum: C Programming
    Replies:
    5
    Views:
    317
    dandelion
    Oct 4, 2004
  4. Christopher Harrison

    Watching a File for Changes

    Christopher Harrison, Oct 18, 2005, in forum: C Programming
    Replies:
    8
    Views:
    338
    Netocrat
    Oct 19, 2005
  5. Gordon Airporte

    Watching a file another app is writing

    Gordon Airporte, Mar 11, 2007, in forum: Python
    Replies:
    8
    Views:
    318
    Gordon Airporte
    Mar 12, 2007
Loading...

Share This Page