Gadfly use (Newby)

Fredrik Lundh fredrik at pythonware.com
Tue Aug 16 07:35:55 EDT 2005


"niko" <n.couturier at noos.fr> wrote:
> while using gadfly, got an error that i don't understand.
> Code is as follow :
>  cursor = connection.cursor()
>  cursor.execute('select id_m from mots where nom_m = "%s"' % nom_m)
>  id_m = cursor.fetchall()
>
> Error message :
> File "C:\Python24\Lib\site-packages\gadfly\kjParser.py", line 567, in
> getmember
>    (Token,skip) = self.LexDict.Token(self.String, self.Position)
>  File "C:\Python24\Lib\site-packages\gadfly\kjParser.py", line 433, in
> Token
>    raise LexTokenError, "Lexical token not found "+info
> gadfly.kjParser.LexTokenError: Lexical token not found near ::
> ' where nom_m = '*'"Ancient s Pled'
>
> Stored value seems to interfere with somethong ? Am i wrong ? Did i
> missed something ? Thanks in advance for any help.

the "%" operator does the substitution *before* the execute method is
called.

maybe you meant

>  cursor.execute('select id_m from mots where nom_m = %s', nom_m)

?

</F> 






More information about the Python-list mailing list