newbie question: using Python to coordinate C++ program and use gnuplot

Eduardo Zea gezea at princeton.edu
Mon Aug 13 02:09:01 CEST 2001


Hello all,

Can someone suggest a good place to look for info on achieving the
following kind of tasks:

1) I have a C++ program that reads a file with parameters (say
parameters.txt) and runs a simulation, then produces an output file (say
output.txt). I want to write a Python program that loops over the
parameter values and on each loop does this:

1. Updates parameters.txt
2. Runs the C++ program with the updated file
3. Renames the output of the C++ program according to the simulation
number, e.g. output1.txt

2) A python program that opens gnuplot in a new terminal, and sends to
it a comand like "plot output.txt". And re-issues this command each time
it updates output.txt, so that gnuplot displays the data as it is being
produced by the program.

I've surfed the www.python.org for hours but can't quite find something
like this.  I don't want a gunplot extension for python, just somehow
pipe a file to gnuplot while the program is running.

Thanks indeed,

Eduardo Zea
Department of Ecology and Evolutionary Biology
Princeton University




More information about the Python-list mailing list