MySQLdbd error. Perhpas it isn't installed?

MRAB python at mrabarnett.plus.com
Wed Mar 27 17:48:44 CET 2013


On 27/03/2013 06:42, Νίκος Γκρ33κ wrote:
> Τη Τετάρτη, 27 Μαρτίου 2013 6:26:06 π.μ. UTC+2, ο χρήστης ru... at yahoo.com έγραψε:
>
>> If not, maybe you can try adding a print statement to your code that
>> will print the value of 'page'.  This will be easier to do if you
>> can run you code interactively.  If you have to run it via a webserver
>> than maybe you'll need wrap the print output in html commands to make
>> it visible on the page, or to write it to a file.
>
>
> I tried what you suggested by doign the following:
>
> print( page )
> sys.exit(0)
> cur.execute( '''SELECT hits FROM counters WHERE url = %s''', (page,) )
>
>
> and the result is printed in the webpage as 'index.html'
>
> so page seem s to be a string but the error is still persistant.
> Anything else i need to try?
>
A brief look at the documentation tells me that MySQL uses '?' as the
placeholder instead of '%s':

cur.execute('''SELECT hits FROM counters WHERE url = ?''', (page, ))




More information about the Python-list mailing list