From: Michael H. <mh...@al...> - 2005-08-19 18:15:16
|
Hello, There is no provision in Gnuplot.py for this. Regarding your attempt, I'm pretty sure that setting sys.stdout doesn't have any effect on spawned programs. And certainly not after the program is already running. Why don't you write the PNG to a temporary file then read that? Michael Nicola Kaiser wrote: > is there any method which I haven=B4t found yet in gnuplot.py to get wh= at > would otherwise be printed on stdout? >=20 > What I actually want to do is to set my terminal to png and have the > binary-png-code stored in a string instead of a file or piped to stdout. >=20 > I treid something like: >=20 > p=3DGnuplot.Gnuplot(debug=3D1) > p('set terminal png') > oldstdout=3Dsys.stdout > output=3DcStringIO.StringIO() # IO-String instanzieren > sys.stdout=3Doutput # stdout nach output umleiten > p.plot([[1,0],[2,50],[3,0],[4,20],[5,0],[6,30],[7,70], [8,70], [9, 75], > [10, 50], [11, 30], [12, 50]]) >=20 >=20 > sys.stdout=3Doldstdout > print output.getvalue() >=20 > But unfortunatelly I also get other stuff like > "gnuplot: unable to open display '' > "gnuplot: X11 aborted" >=20 > Can anyone help me on that? |