Python Script to get Info from Site not working
steve at holdenweb.com
Thu Mar 11 13:37:20 CET 2010
> On Mar 11, 12:38 pm, "Gabriel Genellina" <gagsl-... at yahoo.com.ar>
>> En Wed, 10 Mar 2010 20:06:41 -0300, Jimbo <nill... at yahoo.com> escribió:
>>> I found a semi Python & internet tutorial here if anyone else would
>>> like ithttp://www.upriss.org.uk/python/session6.html
>>> My script is meant to find which radio button is selected & tell me
>>> that. But it just keeps saying "No Drink Selected!"
>> Are you sure? From the code you posted, the message should read "You need
>> to select a drink!", not that one.
>> Replace the last line with something like this, to see what you are
>> getting exactly:
>> print("Sorry, no %r (%r) available." % (
>> BTW, which Python version are you using? The tutorial you linked to is
>> aimed at Python 2.x, but your print syntax suggests you're using Python 3.x
>> Gabriel Genellina
> Yeah that("You need to select a drink!") was the string I was getting
> but I should be getting hot chocolate or something else(which ever one
> I have selected)
> I am using 3.x, do you think I should be using something else? Also
> the your code I put in does the some thing, just now it says "Sorry no
> none drink available" all the time.
It may not seem like it, but you *are* making progress here (of a sort).
>From the information you have given us so far it appears that your call
to form.getvalue() is returning None (which is of type <type 'NoneType'>
- your browser is probably not displaying this because it sees it as a
bogus HTML tag.
Perhaps you haven't yet realised the importance of exact copy-and-paste
here. What I'd like you to do is change the line
drink = form.getvalue("drink")
drink = form.getfirst("drink", "No drink selected")
then have you browser display the HTML source of the response page your
program is returning and paste that into a reply to this mail.
You might also want to take a look at
for further information about the Python library your are trying to use.
In particular I'd recommend heeding its advice about use of the cgitb
Steve Holden +1 571 484 6266 +1 800 494 3119
See PyCon Talks from Atlanta 2010 http://pycon.blip.tv/
Holden Web LLC http://www.holdenweb.com/
UPCOMING EVENTS: http://holdenweb.eventbrite.com/
More information about the Python-list