There's a certain behaviour of pylab that I do not understand. I have written a program that calculates some numbers and writes them to the standard output. After that, show() is called in the same program which gives me a graphical output. When I write
program.py > tmp_file
it opens the graph and writes the numbers to tmp_file. So far, so good. Now, I would like to do the same thing, but automized. But, if I write
program.py > tmp_file &
the konsole is ready for the next commands, but the tmp_file remains empty until the graph is shown (although the show() command follows the print command in program.py, not the other way round). As it takes a while for the graph to be shown, using the tmp_file for further processes is impossible. For example,
program.py > tmp_file &
cat tmp_file
gives an empty output, while
program.py > tmp_file
cat tmp_file
gives the expected resulting values.
What am I doing wrong? Is there a solution to this problem?
I am using the suse standard python installation 2.7.3.
Another question I could not find an answer to: is it possible to write the show() output to stdout? Like program.py > graph.xxx?
Thanks for your help!