thanks, is there another way to use matplotlib print some figure without launch a graphics window? sorry, I'm a new guy to use django and mod_wsgi, and this web page is a test web page... I just want to try how to use matplotlib print a figure on a web page, and thanks again.
2011/8/23 Graham Dumpleton <[email protected]> > Your code is trying to launch a window for display on your desktop. > You cannot really do that from a web application. > > Even if the server was on the same machine, you would need to > configure Apache environment to know about the X Windows display to > use, which will be a non trivial thing to do. > > Are you really wanting to have your web page launch a graphics window? > > Graham > > On 23 August 2011 18:04, 庄克琛 <[email protected]> wrote: > > Dear modwsgi group: > > It's my first time use mod_wsgi, I want use mod_wsgi on a django > app. > > the django app use matplotlib to print some figure. then i meet the error > > below.(and the django app was all right on the django test server, no > error) > > > > > > ############################ > > TclError at /mplimage/ > > couldn't connect to display ":0" > > Request Method: GET > > Request URL: http://localhost/mplimage/ > > Django Version: 1.3 > > Exception Type: TclError > > Exception Value: > > couldn't connect to display ":0" > > Exception Location: /usr/lib/python2.7/lib-tk/Tkinter.py in __init__, > line > > 1688 > > Python Executable: /usr/bin/python > > Python Version: 2.7.1 > > ################################ > > Traceback > > /usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py in > > get_response > > response = callback(request, *callback_args, > > **callback_kwargs) > > /home/function/DjangoPy/test01/mysite/png/views.py in mplimage > > fig = plt.figure() > > /usr/lib/pymodules/python2.7/matplotlib/pyplot.py in figure > > **kwargs) > > /usr/lib/pymodules/python2.7/matplotlib/backends/backend_tkagg.py in > > new_figure_manager > > window = Tk.Tk() > > /usr/lib/python2.7/lib-tk/Tkinter.py in __init__ > > self.tk = _tkinter.create(screenName, baseName, className, > > interactive, wantobjects, useTk, sync, use) > > ▼ Local vars > > Variable Value > > className 'Tk' > > use None > > baseName 'mod_wsgi' > > useTk 1 > > sync 0 > > sys <module 'sys'(built-in)> > > ext '' > > screenName None > > os <module 'os' from '/usr/lib/python2.7/os.pyc'> > > self None > > interactive 0 > > ############################# > > Is there anyone can help me why this error happen? thanks very much! > > > > -- > > You received this message because you are subscribed to the Google Groups > > "modwsgi" group. > > To post to this group, send email to [email protected]. > > To unsubscribe from this group, send email to > > [email protected]. > > For more options, visit this group at > > http://groups.google.com/group/modwsgi?hl=en. > > > > -- > You received this message because you are subscribed to the Google Groups > "modwsgi" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/modwsgi?hl=en. > > -- You received this message because you are subscribed to the Google Groups "modwsgi" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/modwsgi?hl=en.
