Re: dynamically creating html code with python...

2008-08-11 Thread Stefan Behnel
Hi, [EMAIL PROTECTED] wrote: > how can I combine some dynamically generated html code (using python) with > the output of a urllib.openurl() call? Why reinvent the wheel? Try one of the existing web frameworks. There may be a learning curve for most of them, but you may also end up doing things t

Re: dynamically creating html code with python...

2008-08-11 Thread Gabriel Genellina
En Mon, 11 Aug 2008 18:47:53 -0300, <[EMAIL PROTECTED]> escribi�: BTW, you are right about me not having a clue about http. It's the first time I try to do something with it. May be you could point me out to some good links where I can learn. This topic was discussed some time ago - perhaps

Re: dynamically creating html code with python...

2008-08-11 Thread Carsten Haese
[EMAIL PROTECTED] wrote: [CODE] f = StringIO.StringIO() pylab.savefig(f) return 'data:image/png,' + urllib.quote(f.getvalue()) [/CODE] This works fine in Firefox, but not in IE7. Any ideas why? Yes. Internet Explorer doesn't support the "data:" URI scheme. -- Carsten Haese http:/

Re: dynamically creating html code with python...

2008-08-11 Thread anartz
btw, credits for the code shown below also for: http://bitworking.org/news/Sparklines_in_data_URIs_in_Python [EMAIL PROTECTED] wrote : > This makes sense. Thanks! > > I managed to get what I wanted with something similar to what you suggested: > > [CODE] > print "Content-Type: text/html\n\n" >

Re: dynamically creating html code with python...

2008-08-11 Thread anartz
This makes sense. Thanks! I managed to get what I wanted with something similar to what you suggested: [CODE] print "Content-Type: text/html\n\n" html=""" data analysis site This is a test After image text """ print html

Re: dynamically creating html code with python...

2008-08-11 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : Sorry, my fault... I am trying to build a web application for data analysis. Basically some data will be read from a database and passed to a python script (myLibs.py) to build an image as follows. [CODE] f=urllib.urlopen("http://localhost/path2Libs/myLibs.py",urlli

Re: dynamically creating html code with python...

2008-08-11 Thread Diez B. Roggisch
[EMAIL PROTECTED] wrote: > Hi, > > Thanks for your patience. > > I got the text displayed in the web browser with the following code: > > [CODE] > f=StringIO.StringIO() > f.write('data analysis site') > f.write("This is a trial test") > f.write("") > > print "Content-type: text/html\n" > print

Re: dynamically creating html code with python...

2008-08-11 Thread Timothy Grant
On Mon, Aug 11, 2008 at 10:05 AM, <[EMAIL PROTECTED]> wrote: > Hi, > > Thanks for your patience. > > I got the text displayed in the web browser with the following code: > > [CODE] > f=StringIO.StringIO() > f.write('data analysis site') > f.write("This is a trial test") > f.write("") > > print "Co

Re: dynamically creating html code with python...

2008-08-11 Thread anartz
Hi, Thanks for your patience. I got the text displayed in the web browser with the following code: [CODE] f=StringIO.StringIO() f.write('data analysis site') f.write("This is a trial test") f.write("") print "Content-type: text/html\n" print f.getvalue() f.close() [/CODE] Now I am trying to pu

Re: dynamically creating html code with python...

2008-08-11 Thread Jerry Hill
On Mon, Aug 11, 2008 at 12:26 PM, <[EMAIL PROTECTED]> wrote: > I have tried calling a script containing the code below from a web browser > and it did not get the text. You quoted my post that answered this question, but did not implement either of the two solutions I suggested. I continue to s

Re: dynamically creating html code with python...

2008-08-11 Thread anartz
I have tried calling a script containing the code below from a web browser and it did not get the text. [CODE] #!c:/Python25/python.exe -u import StringIO f=StringIO.StringIO() f.write('data analysis site') f.write("This is a trial test") f.write("") print "Content-type: text/html\n" print f.r

Re: dynamically creating html code with python...

2008-08-11 Thread anartz
Sorry, my fault... I am trying to build a web application for data analysis. Basically some data will be read from a database and passed to a python script (myLibs.py) to build an image as follows. [CODE] f=urllib.urlopen("http://localhost/path2Libs/myLibs.py",urllib.urlencode(TheData)) print "

Re: dynamically creating html code with python...

2008-08-11 Thread Jerry Hill
On Mon, Aug 11, 2008 at 9:15 AM, <[EMAIL PROTECTED]> wrote: > [CODE] > f=StringIO.StringIO() > f.write('data analysis') > f.write(urllib.urlopen("http://localhost/path2Libs/myLibs.py";, > urllib.urlencode(TheData))) > f.write("") > > print "Content-type: text/html\n" > print f.read() > f.close()

Re: dynamically creating html code with python...

2008-08-11 Thread Carsten Haese
[EMAIL PROTECTED] wrote: Hi, how can I combine some dynamically generated html code (using python) with the output of a urllib.openurl() call? I have tried to use the StringIO() class with .write functions, but it did not work. Below is the code that does not work. Help us help you. "Does n