generating stats from stdout on a regular interval

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • russ

    #1

    generating stats from stdout on a regular interval

    Hi all,

    Very new to Python - but excited to see what is possible - it sounds
    very suitable for a project of mine I need a little help with.

    I've got an executable which writes out data to stdout in a CSV sort
    of format - I'd like to grab the data from stdout and create stats
    from it at a regular interval, i.e. every 10 min. Probably push the
    stats out to a CSV file.

    The popen2 module can read the stdout just like a file, and the csv
    module can handle the reading / writing. How do I go about
    'processing' the stdout every 10 min?

    Thanks,
    Russ

  • Gabriel Genellina

    #2
    Re: generating stats from stdout on a regular interval

    En Tue, 20 Mar 2007 22:45:16 -0300, russ <russell.sayers @gmail.com>
    escribió:
    Very new to Python - but excited to see what is possible - it sounds
    very suitable for a project of mine I need a little help with.
    >
    I've got an executable which writes out data to stdout in a CSV sort
    of format - I'd like to grab the data from stdout and create stats
    from it at a regular interval, i.e. every 10 min. Probably push the
    stats out to a CSV file.
    >
    The popen2 module can read the stdout just like a file, and the csv
    module can handle the reading / writing. How do I go about
    'processing' the stdout every 10 min?
    The executable is continuously writting data to stdout, right?
    So your code will likely be reading that output inside a loop - just check
    using time.time() if the desired interval has elapsed.
    Maybe you'd prefer using the subprocess module instead of popen2.

    --
    Gabriel Genellina

    Comment

    Working...