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. Advertisements

  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. Advertisements

  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. Advertisements

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. Paul Richards
    Replies:
    0
    Views:
    434
    Paul Richards
    Dec 11, 2003
  2. Luis Esteban Valencia Muñoz
    Replies:
    3
    Views:
    1,615
    Scott Allen
    Jun 4, 2005
  3. Bomb Diggy
    Replies:
    11
    Views:
    6,489
    Ivan S Kirkpatrick
    Jul 3, 2003
  4. Benjamin D. LeMasurier

    watching a file

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

    Watching a File for Changes

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

    Watching a file another app is writing

    Gordon Airporte, Mar 11, 2007, in forum: Python
    Replies:
    8
    Views:
    372
    Gordon Airporte
    Mar 12, 2007
  7. Replies:
    4
    Views:
    518
  8. Bil Kleb
    Replies:
    3
    Views:
    146
    Bil Kleb
    Aug 16, 2006
Loading...