Re: [Tutor] python cgi single double quotes

2016-07-20 Thread nitin chandra
Me a little embarrassed :P ... but now when I retyped the code ... it seems to be working Alan, Peter .. .Thank you. On 20 July 2016 at 17:24, Peter Otten <__pete...@web.de> wrote: > nitin chandra wrote: > >> Ran both the method > > So everything seems to be working as expected. When you go

Re: [Tutor] python cgi single double quotes

2016-07-20 Thread Peter Otten
nitin chandra wrote: > Ran both the method So everything seems to be working as expected. When you go back to your original script you can enable tracebacks rendered as html with #!/usr/bin/env python import cgitb cgitb.enable() ... # your code Provided there are no syntax errors in the scrip

Re: [Tutor] python cgi single double quotes

2016-07-20 Thread nitin chandra
Ran both the method #!/usr/bin/env python import cgi import psycopg2 import sys print """Content-type:text/html\r\n\r\n""" print """ Hello Word - First CGI Program Hello Word! This is my first CGI program {version} First name: """.format(version=sys.version) and its output (below) nitin@n

Re: [Tutor] python cgi single double quotes

2016-07-20 Thread Peter Otten
nitin chandra wrote: > On inserting the line ... > > print " + "sys.version + "" > > required slight correction > > print "" + sys.version + "" > > and the following script and its output are below :- > > #!/usr/bin/env python > > import sys > import c

Re: [Tutor] python cgi single double quotes

2016-07-20 Thread nitin chandra
On inserting the line ... print " + "sys.version + "" required slight correction print "" + sys.version + "" and the following script and its output are below :- #!/usr/bin/env python import sys import cgi import psycopg2 print "Content-type:text/html\

Re: [Tutor] python cgi single double quotes

2016-07-20 Thread Alan Gauld via Tutor
On 20/07/16 09:23, nitin chandra wrote: > vimal@Ubuntu-1404-trusty-64-minimal:~$ python > Python 2.7.6 (default, Jun 22 2015, 17:58:13) > [GCC 4.8.2] on linux2 > Type "help", "copyright", "credits" or "license" for more information. import sys print sys.version > 2.7.6 (default, Jun 22 2

Re: [Tutor] python cgi single double quotes

2016-07-20 Thread nitin chandra
Hi Alan, vimal@Ubuntu-1404-trusty-64-minimal:~$ python Python 2.7.6 (default, Jun 22 2015, 17:58:13) [GCC 4.8.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import sys >>> print sys.version 2.7.6 (default, Jun 22 2015, 17:58:13) [GCC 4.8.2] >>> Should I t

Re: [Tutor] python cgi single double quotes

2016-07-19 Thread Alan Gauld via Tutor
On 19/07/16 19:43, nitin chandra wrote: > Now I have taken a VPS, using command line, I installed apache2.4, > python 2.7, but I am not able to use the same code with triple quotes > (""") to open and close the code block. > > I am forced to use > > print "Content-type:text/html\r\n\r\n" > print

Re: [Tutor] Python, CGI and CSS

2008-04-10 Thread Alex Krycek
Thank you all for your help. I've finally figured it out. I took people's suggestions and typed in the path for the CSS file into my browser. Well, I received an internal service error. When I checked the error log, I had received the following: [Thu Apr 10 20:38:47 2008] [error] [client ::1] (8)E

Re: [Tutor] Python, CGI and CSS

2008-04-10 Thread Curtis Adkins
It seems that your link to the stylesheet is just pointing to the wrong place. Like the others said, check to make sure you are pointing to the right place of the CSS file by typing it into the web browser. If you use the link you gave : "http://localhost/cgi-bin/style1.css"; what shows up? Anyth

Re: [Tutor] Python, CGI and CSS

2008-04-10 Thread Alan Gauld
"Alex Krycek" <[EMAIL PROTECTED]> wrote > I did look into CGI tutorials, but they didn't use Python code. They > used > something like: > start_html(-title => $title, > -head => style({type => 'text/css'} ) That looks like Perl. Try the CGI tutorial on the Python web site. That would be a goo

Re: [Tutor] Python, CGI and CSS

2008-04-10 Thread Alan Gauld
"Alex Krycek" <[EMAIL PROTECTED]> wrote > How do I apply an external stylesheet to the XHTML in a Python > script? Python doesn't really do anything with CSS that is handled by the browser. All Python can do is insert the correct HTML into the server response to the browser. > I tried to inclu

Re: [Tutor] Python, CGI and CSS

2008-04-10 Thread Kent Johnson
Alex Krycek wrote: > Eric, > > I'm sorry, I never actually managed to get any stylesheets to work with > my cgi scripts. The scripts that did work are just simple HTML. Where are the css files that work located? What URL is used to fetch them? If you put the css for your cgi into the same loca

Re: [Tutor] Python, CGI and CSS

2008-04-10 Thread Eric Walstad
Hey Alex, On Thu, Apr 10, 2008 at 1:43 PM, Alex Krycek <[EMAIL PROTECTED]> wrote: > Eric, > > I'm sorry, I never actually managed to get any stylesheets to work with my > cgi scripts. The scripts that did work are just simple HTML. I'm using > Apache 2.2.8 on a Mac OS X 10.4.11 system. If I underst

Re: [Tutor] Python, CGI and CSS

2008-04-10 Thread Alex Krycek
Eric, I'm sorry, I never actually managed to get any stylesheets to work with my cgi scripts. The scripts that did work are just simple HTML. I'm using Apache 2.2.8 on a Mac OS X 10.4.11 system. When I get home I'll definitely look up the log file and paste it here. I'll also have to fool around w

Re: [Tutor] Python, CGI and CSS

2008-04-10 Thread Eric Walstad
Hi Alex, On Thu, Apr 10, 2008 at 1:22 PM, Alex Krycek <[EMAIL PROTECTED]> wrote: > Hi, > > I've looked all over the internet but have not found an answer to my > question. How do I apply an external stylesheet to the XHTML in a Python > script? I tried to include the standard " type='text/css' href

Re: [Tutor] Python, CGI and CSS

2008-04-10 Thread Steve Willoughby
On Thu, Apr 10, 2008 at 02:22:47PM -0600, Alex Krycek wrote: > Hi, > > I've looked all over the internet but have not found an answer to my > question. How do I apply an external stylesheet to the XHTML in a Python > script? I tried to include the standard " type='text/css' href='style1.css' />""

Re: [Tutor] Python / CGI

2007-09-07 Thread Fiyawerx
Wow, thanks for all the info guys, more than i was expecting :). After looking around at various options, I did download the python gdata module for google's calendar. What I'm thinking is, since my fiance has two schools, she can just log into her google account and create a calendar for each scho

Re: [Tutor] Python / CGI

2007-09-07 Thread Steve Willoughby
John wrote: > Steve, > > If you're interested in just banging out a Python app, though, my > experience > was writing a calendaring tool for a group of my friends who get > together > [...] > This sounds very cool, is it something you could post? Okay. It's not the greatest

Re: [Tutor] Python / CGI

2007-09-06 Thread Alan Gauld
"Fiyawerx" <[EMAIL PROTECTED]> wrote > Hi guys, quick question, I've been trying to learn python lately, > and have > written a few little apps to help with some day to day stuff I do, > and > recently my fiance asked me if it was possible to come up with a > simple web > based schedule she can

Re: [Tutor] Python / CGI

2007-09-06 Thread Steve Willoughby
On Thu, Sep 06, 2007 at 11:35:14AM -0400, Fiyawerx wrote: > recently my fiance asked me if it was possible to come up with a simple web > based schedule she can use with the other teachers in her school to schedule > library time. (She's the librarian). Basically, it will be a small calendar > like

Re: [Tutor] Python / CGI

2007-09-06 Thread Eric Walstad
Michael Connors wrote: > Hi, > If you have your own server to run it on, I think it would make sense to > use one of the Python web frameworks that are out there. I used cherrypy > for my first web-based python project and I found it very easy to learn > and develop in quickly. > Regards, > Michael

Re: [Tutor] Python / CGI

2007-09-06 Thread Eric Brunson
Kent Johnson wrote: > Eric Brunson wrote: > >> Michael Connors wrote: >> >>> Hi, >>> If you have your own server to run it on, I think it would make sense >>> to use one of the Python web frameworks that are out there. I used >>> cherrypy for my first web-based python project and I found

Re: [Tutor] Python / CGI

2007-09-06 Thread Kent Johnson
Eric Brunson wrote: > Michael Connors wrote: >> Hi, >> If you have your own server to run it on, I think it would make sense >> to use one of the Python web frameworks that are out there. I used >> cherrypy for my first web-based python project and I found it very >> easy to learn and develop in

Re: [Tutor] Python / CGI

2007-09-06 Thread Kent Johnson
Fiyawerx wrote: > Hi guys, quick question, I've been trying to learn python lately, and > have written a few little apps to help with some day to day stuff I do, > and recently my fiance asked me if it was possible to come up with a > simple web based schedule she can use with the other teachers

Re: [Tutor] Python / CGI

2007-09-06 Thread Eric Brunson
Michael Connors wrote: > Hi, > If you have your own server to run it on, I think it would make sense > to use one of the Python web frameworks that are out there. I used > cherrypy for my first web-based python project and I found it very > easy to learn and develop in quickly. That's debatable

Re: [Tutor] Python / CGI

2007-09-06 Thread Fiyawerx
Thanks Michael, I'll be using my dreamhost account, and I'm pretty sure cherrypy works there, will check into it. On 9/6/07, Michael Connors <[EMAIL PROTECTED]> wrote: > > Hi, > If you have your own server to run it on, I think it would make sense to > use one of the Python web frameworks that are

Re: [Tutor] Python / CGI

2007-09-06 Thread Michael Connors
Hi, If you have your own server to run it on, I think it would make sense to use one of the Python web frameworks that are out there. I used cherrypy for my first web-based python project and I found it very easy to learn and develop in quickly. Regards, Michael On 06/09/07, Fiyawerx <[EMAIL PROTE

Re: [Tutor] Python cgi scripting

2006-12-27 Thread Alan Gauld
"Troy" <[EMAIL PROTECTED]> wrote > Hello. I'm just starting to learn Python, and want to do some > python > cgi scripting. Can someone recommend a good web site or online > reference (beginner level)? The standard documentation for cgi is pretty good. Also check out the Web Programming Topic

Re: [Tutor] Python cgi scripting

2006-12-27 Thread Mike Hansen
> -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Troy > Sent: Tuesday, December 26, 2006 10:01 PM > To: tutor@python.org > Subject: [Tutor] Python cgi scripting > > Hello. I'm just starting to learn Python, and want to do some python > cgi script

Re: [Tutor] Python CGI Script

2006-09-22 Thread Alan Gauld
> > cur.execute("INSERT INTO images (image) VALUES (?)", data_obj) > >In my case, I'm using psycopg2 for PostgreSQL. I just did a test, > and it doesn't seem to like the ? syntax. I'll check the > documentation > to see if there's a setting to have it use the ? syntax. It may well be the Python c

Re: [Tutor] Python CGI Script

2006-09-21 Thread Python
On Thu, 2006-09-21 at 08:38 -0600, Mike Hansen wrote: > > > -Original Message- > > From: Alan Gauld [mailto:[EMAIL PROTECTED] > > Sent: Thursday, September 21, 2006 2:51 AM > > To: Mike Hansen; tutor@python.org > > Subje

Re: [Tutor] Python CGI Script

2006-09-21 Thread Mike Hansen
> -Original Message- > From: Alan Gauld [mailto:[EMAIL PROTECTED] > Sent: Thursday, September 21, 2006 2:51 AM > To: Mike Hansen; tutor@python.org > Subject: Re: [Tutor] Python CGI Script > > >sql_statement = "INSERT I

Re: [Tutor] Python CGI Script

2006-09-21 Thread Alan Gauld
>sql_statement = "INSERT INTO images (image) VALUES (%s)" >cur.execute(sql_statement, (data_obj, )) > >Is it just moving the variable substitution to the execute statement >as > a tuple, so it will perform the proper quoting? Nope, the syntax changes slightly, and I believ

Re: [Tutor] Python CGI Script

2006-09-20 Thread Python
On Wed, 2006-09-20 at 15:46 -0600, Mike Hansen wrote: > > > -Original Message- > > Subject: Re: [Tutor] Python CGI Script > > > > >query1 = """SELECT ABC FROM %s limit %s,%s"""\ > > >

Re: [Tutor] Python CGI Script

2006-09-20 Thread Mike Hansen
> -Original Message- > Subject: Re: [Tutor] Python CGI Script > > >query1 = """SELECT ABC FROM %s limit %s,%s"""\ > > % (self.tableid,self.rangeid1,self.rangeid2) > > Just as a note: please don'

Re: [Tutor] Python CGI Script

2006-09-20 Thread Danny Yoo
>query1 = """SELECT ABC FROM %s limit %s,%s"""\ > % (self.tableid,self.rangeid1,self.rangeid2) Just as a note: please don't do this! *grin* Don't build query strings up like this: this is very prone to an SQL injection attack. See: http://mail.python.org/pipe

Re: [Tutor] Python CGI Script

2006-09-20 Thread Kent Johnson
Faran wrote: > I Have a CGI Script Which is working perfectly when run from the python > interpreter, i m using the Content-type: > application/x-www-url-form-encoded , i use it to send data from flash > apps to python script. i checked the script with content-type: text/html > , and browsers p

Re: [Tutor] python cgi and html streams

2006-05-06 Thread doug shawhan
On 5/5/06, Danny Yoo <[EMAIL PROTECTED]> wrote: > I was hoping for something magical like:>> gulp = cgi.StreamIO("> http://www.foo.com/cgi-bin/responder.cgi?foo=hi&bar=there&bat=buddy ").read()>> ... but for some reason not one of the python creators foresaw that I might> one day need them to do al

Re: [Tutor] python cgi and html streams

2006-05-05 Thread Danny Yoo
> I was hoping for something magical like: > > gulp = cgi.StreamIO(" > http://www.foo.com/cgi-bin/responder.cgi?foo=hi&bar=there&bat=buddy";).read() > > ... but for some reason not one of the python creators foresaw that I might > one day need them to do all the thinking, typing and other hard par

Re: [Tutor] Python cgi doesn't get data from html form as expected

2005-03-22 Thread Vicki Stanfield
> Please post the HTML for the form you are submitting and the HTML from a > View Source on the result. > > Kent Sorry to have bothered the list. I figured out the answer (sort of). I had parse the HTML code through an XHTML parser which removed all the name= leaving id= only. That doesn't work wi

Re: [Tutor] Python cgi doesn't get data from html form as expected

2005-03-22 Thread Kent Johnson
Vicki Stanfield wrote: I don't see anything in that page that changes what I am doing. I can get rid of everything that has to do with retrieving data from cgi-FieldStorage, and the code executes fine although I get a blank page. I have revised the code somewhat, but the initial problem of cgi.Fiel

Re: [Tutor] Python cgi doesn't get data from html form as expected

2005-03-22 Thread Vicki Stanfield
> I haven't done too much web stuff (or much of anything) with python, but > I looked into your question a bit (researching other's problems may help > me avoid them =)). A quick search brought up this page which seems to > have information which may help you. > > http://gnosis.cx/publish/programm

Re: [Tutor] Python cgi doesn't get data from html form as expected

2005-03-22 Thread Michael Lasky
I haven't done too much web stuff (or much of anything) with python, but I looked into your question a bit (researching other's problems may help me avoid them =)). A quick search brought up this page which seems to have information which may help you. http://gnosis.cx/publish/programming/feature