From: Michael H. <mh...@al...> - 2007-06-14 08:46:02
|
Pablo Aguado wrote: > I've tried to replot more than 25 times using gnuplot directly and I > can, so the problem must be in my code or in gnuplot.py. The error > message I receive is this: > > Traceback (most recent call last): > File "bands-spin.py", line 153, in ? > g.replot(bandplot[iplot]) > File "/usr/lib/python2.4/site-packages/Gnuplot/_Gnuplot.py", line > 322, in replot > self.refresh() > File "/usr/lib/python2.4/site-packages/Gnuplot/_Gnuplot.py", line > 214, in refresh > plotcmds.append(item.command()) > File "/usr/lib/python2.4/site-packages/Gnuplot/PlotItems.py", line > 192, in command > return string.join([ > File "/usr/lib/python2.4/site-packages/Gnuplot/PlotItems.py", line > 451, in get_base_command_string > fifo = _FIFOWriter(self.content, self.mode) > File "/usr/lib/python2.4/site-packages/Gnuplot/PlotItems.py", line > 411, in __init__ > self.start() > File "/usr/lib/python2.4/threading.py", line 416, in start > _start_new_thread(self.__bootstrap, ()) > thread.error: can't start new thread > > > where bands-spin.py is my code. The problem appears in a loop like this: > > for iplot in range(0,norb): > g.replot(bandplot[iplot]) > > It works fine if I set norb=24, if I set it to 25 sometimes work and > sometimes it doesn't (the data plotted doesn't change!!) and if I set > it to 26 or more it always crash. Oh, it looks like your operating system is limiting the number of threads that Gnuplot.py can start. Gnuplot.py starts a thread for each item that is passed to gnuplot via a named pipe (the thread is responsible for writing the data into the pipe as gnuplot reads it out). You could consider increasing the number of threads allowed to each process. But probably a better solution would be to have Gnuplot.py pass your data to gnuplot via another mechanism, like via temporary files. See the FAQ and gp_unix.py for more information, including caveats. Michael |