Have you shown us your entire index() function? If so, your view file isn't getting called at all because your index function is not returning a dictionary. Instead, web2py is simply returning whatever your function returns, which is probably None if the last line is a call to plt.savefig(). Add return dict() to the end of your index function, and see if it works. Views are only called if the controller function returns a dictionary.
Anthony On Thursday, September 8, 2011 3:55:35 PM UTC-4, Richard wrote: > > The mp1.png file is in the static directory of my application > > The following views/default/index only gives an empty page with "None" > in the top left corner. > > {{left_sidebar_enabled=right_sidebar_enabled=False}} > > {{extend 'layout.html'}} > {{if 'message' in globals():}} > > <h1>{{=message}}</h1> > > #<h2>Events</h2> > #{{=db().select(db.Events.ALL)}} > > <p> Outfile from Matplotlib > <img src="{{=URL('static','mp1.png')}}"/> > </p> > > {{else:}} > {{=BEATIFY(response.vars)}} > {{pass}} > > {{block left_sidebar}}New Left Sidebar Content{{end}} > {{block right_sidebar}}New Right Sidebar Content{{end}} > > > Op 7-9-2011 23:35, Richard Dijkstra schreef: > > Looking closer an output window appears and the console gives errors on the > sequence of calling matplotlib.backends: > > I'll check first. > > > > Op 7 sep 2011, om 22:43 heeft Anthony het volgende geschreven: > > But does > plt.savefig(os.path.join(request.folder,'static','mp1.png'),format='png') > result in a file being saved in c:\web2py\applications\your_app\static\? > > > On Wednesday, September 7, 2011 4:38:13 PM UTC-4, Richard wrote: >> >> Anthony, >> >> plt.savefig('c:\web2py\outputfile.png',format='png') >> >> does me give an accessable png-file >> >> Op 7-9-2011 22:20, Anthony schreef: >> >> Have you confirmed that the file is actually getting saved in the expected >> location? Are you able to run the matplotlib code and save the file outside >> of web2py? >> >> >> On Wednesday, September 7, 2011 4:05:08 PM UTC-4, Richard wrote: >>> >>> Only adding the .png extention is not sufficient. >>> >>> outputfile = os.path.join(request.folder,'static','mp1.png') >>> plt.savefig(outputfile,format='png') >>> >>> >>> <p> Outfile from Matplotlib >>> <img src="{{=URL('static','mp1.png')}}" /> >>> </p> >>> >>> >>> Besides this issue; is using a temporarily file a mature solution or is >>> streaming preferrable? >>> >>> Richard >>> >>> >>> Op 7-9-2011 21:46, Anthony schreef: >>> >>> On Wednesday, September 7, 2011 3:35:23 PM UTC-4, Richard wrote: >>>> >>>> >>>> <img src="{{=URL('static','mp1')}}" /> >>>> >>> >>> Should be URL('static','mp1.png'). >>> >>> Anthony >>> >>> >>> Geen virus gevonden in het binnenkomende-bericht. >>> Gecontroleerd door AVG - www.avg.com >>> Versie: 9.0.872 / Virusdatabase: 271.1.1/3872 - datum van uitgifte: >>> 09/02/11 08:34:00 >>> >>> >>> >>> >> >> Geen virus gevonden in het binnenkomende-bericht. >> Gecontroleerd door AVG - www.avg.com >> Versie: 9.0.872 / Virusdatabase: 271.1.1/3872 - datum van uitgifte: 09/02/11 >> 08:34:00 >> >> >> >> > > > Geen virus gevonden in het binnenkomende-bericht. > Gecontroleerd door AVG - www.avg.com > Versie: 9.0.872 / Virusdatabase: 271.1.1/3878 - datum van uitgifte: 09/05/11 > 08:35:00 > > > >