7.14 Script watching: pyxplot_watch

Pyxplot includes a simple tool for watching command script files and executing them whenever they are modified. This may be useful when developing a command script, if one wants to make small modifications to it and see the results in a semi-live fashion. This tool is invoked by calling the pyxplot_watch command from a shell prompt. The command-line syntax of pyxplot_watch is similar to that of Pyxplot itself, for example:

pyxplot_watch script.ppl

would set pyxplot_watch to watch the command script file script.ppl. One difference, however, is that if multiple script files are specified on the command line, they are watched and executed independently, not sequentially, as Pyxplot itself would do. Wildcard characters can also be used to set pyxplot_watch to watch multiple files.1

This is especially useful when combined with ghostview’s watch facility. For example, suppose that a script foo.ppl produces PostScript output foo.ps. The following two commands could be used to give a live view of the result of executing this script:

gv --watch foo.ps &
pyxplot_watch foo.ppl

Footnotes

  1. Note that pyxplot_watch *.script and pyxplot_watch $\backslash $*.script will behave differently in most UNIX shells. In the first case, the wildcard is expanded by your shell, and a list of files passed to pyxplot_watch. Any files matching the wildcard, created after running pyxplot_watch, will not be picked up. In the latter case, the wildcard is expanded by pyxplot_watch itself, which will pick up any newly created files.