a newbie question about gadfly

jm7potter at hotmail.com jm7potter at hotmail.com
Wed Jun 13 09:14:09 EDT 2001


On 12 Jun 2001 15:34:16 GMT, gbreed at cix.compulink.co.uk wrote:

>In article <hrbcit86g5gbmc63em9gc6tsji7nv78dqr at 4ax.com>, 
>jm7potter at hotmail.com () wrote:
>
>> Why? is namex not a direct replacement for "donna" ????
>
>Um, no, not the way you're doing it.  Try replacing that magic 
>line with
>
>cursor.execute(
>  "insert into students (name, grade) values (%s, %s)"
>  % (namex, gradex))
>
>Or even
>
>cursor.execute("insert into students (name, grade) values 
>(%(namex)s, %(gradex)s)" % vars())
>
>(that's sure to wordwrap!)
>
>
>                 Graham


Thanks for the help Graham,

However, your code did not work either. The little program chokes every time I try to
do anything that is not "hard-wired" into the script.

Oddly, the books that mention gadfly do not attempt anything but hard-wired code.
Perhaps they know something?

Hammond & Robinson cover gadfly in their "Python: programming on Win32"  (pp. 256
-259) but never attempt to get data from a user and send it to the database.

 For that matter, in "Learning Python" I see that Lutz & Ascher do not even attempt
to get user input until page 200 when as an aside to exception handling they tell us
about raw_input. Well, they do get user input via command line arguments, but that
can take one only so far.

There must be something real simple that I am missing here. If it was hard, someone
would have done 5 chapters on it by now.

Thanks again for the try.


Regards, Joe





More information about the Python-list mailing list