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
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
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().
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
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
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
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
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.
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
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
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
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 =
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
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')
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,
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
16 matches
Mail list logo