Re: [web2py] Re: matplotlib output

2011-09-08 Thread Richard Dijkstra
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

Re: [web2py] Re: matplotlib output

2011-09-08 Thread Richard Vézina
Not sure but I think there is a mistake in your view that should be ok without it The # not work to comment a line in the view so try remove your line completly or you may try with !-- -- html commenting caracter... But those don't prevent web2py to interpret the {{=}}, so what I usually do si to

Re: [web2py] Re: matplotlib output

2011-09-08 Thread Anthony
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().

Re: [web2py] Re: matplotlib output

2011-09-08 Thread Richard Dijkstra
Richard, To be sure about the comment I made the following view, which had the same None result {{extend 'layout.html'}} p Outfile from Matplotlib img src={{=URL('static','mp1.png')}}/ /p regards, Richard Op 8-9-2011 22:11, Richard Vézina schreef: Not sure but I think there is a mistake

Re: [web2py] Re: matplotlib output

2011-09-08 Thread Richard Dijkstra
The view is not executed. Adding return dict() doesn't have effect. Even this dict() does not lead to an error. {{extend 'layout.html'}} {{if 'message' in globals():}} p Outfile from Matplotlib img src={{=URL('static','mp1.png')}}/ /p return dict() Op 8-9-2011 22:24, Anthony

Re: [web2py] Re: matplotlib output

2011-09-08 Thread Richard Vézina
The view need a controller to return a dict variable at least one to be executed I think... So maybe your controller has noting to do so you just have created a view with the code that you want to be executed (the code that you showed us)... Try returning a empty var from your controller if you

Re: [web2py] Re: matplotlib output

2011-09-08 Thread Anthony
No, you need to add return dict() to the end of you index() function in your controller -- not to the view file. Anthony On Thursday, September 8, 2011 4:45:51 PM UTC-4, Richard wrote: The view is not executed. Adding return dict() doesn't have effect. Even this dict() does not lead to

Re: [web2py] Re: matplotlib output

2011-09-08 Thread Richard Vézina
haha I wasn't understand why he was putting that there and I didn't realise it was a mistake ;-) Richard On Thu, Sep 8, 2011 at 5:30 PM, Anthony abasta...@gmail.com wrote: No, you need to add return dict() to the end of you index() function in your controller -- not to the view file.

Re: [web2py] Re: matplotlib output

2011-09-08 Thread Richard Dijkstra
It works, thanks :) Next step is to upgrade the HTML code because this just looks like text. regards, Richard Op 8-9-2011 23:30, Anthony schreef: No, you need to add return dict() to the end of you index() function in your controller -- not to the view file. Anthony On Thursday, September

[web2py] Re: matplotlib output

2011-09-07 Thread Anthony
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

Re: [web2py] Re: matplotlib output

2011-09-07 Thread Richard Dijkstra
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

Re: [web2py] Re: matplotlib output

2011-09-07 Thread Anthony
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 =

Re: [web2py] Re: matplotlib output

2011-09-07 Thread Richard Dijkstra
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

Re: [web2py] Re: matplotlib output

2011-09-07 Thread Anthony
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')

Re: [web2py] Re: matplotlib output

2011-09-07 Thread Richard Dijkstra
Yes it does :) 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,

Re: [web2py] Re: matplotlib output

2011-09-07 Thread Richard Dijkstra
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