python - Matplotlib subprocess/backend issue -


i want plot (i.e. write file) matplotlib script runs subprocess (launched python cgi-script apache server), somehow either plot isn't created or server crashes depending on backend use. think should using "agg", , plot created in case, server crashes (internal server error). here's log:

ah01215: /usr/lib/pymodules/python2.7/gtk-2.0/gtk/__init__.py:57: gtkwarning: not open display, referer: http://localhost/ ah01215:   warnings.warn(str(e), _gtk.warning), referer: http://localhost/ ah01215: /usr/local/lib/python2.7/dist-packages/matplotlib/backends/backend_gtk.py:49: gtkwarning: ia__gdk_cursor_new_for_display: assertion `gdk_is_display (display)' failed, referer: http://localhost/ ah01215:   cursors.move          : gdk.cursor(gdk.fleur),, referer: http://localhost/ malformed header script 'submit.cgi': bad header: ['/home/user/..., referer: http://localhost/ 

the cgi-script doens't depend on output of subprocess @ moment, don't bad-header warning (and there no such problem when not launching subprocess). beginning of plot-script looks this:

import string import sys import os math import * import tempfile os.environ['mplconfigdir'] = tempfile.mkdtemp() import matplotlib matplotlib.use('agg')  import matplotlib.pyplot matplot matplotlib import mpl 

so far did rather simple plot matplotlib , not subprocesses, appreciate help.

ps: i'm using ubuntu 11.04 , apache2

i suspect plot script output stuff stdout , apache interpreting headers expecting cgi.

when call script subprocess, redirect output dev null, this

from subprocess import popen, stdout import os  p = popen(["ls","-l"], stdout=open(os.devnull, "w"), stderr=stdout) 

Comments

Popular posts from this blog

django - How can I change user group without delete record -

java - Need to add SOAP security token -

java - EclipseLink JPA Object is not a known entity type -