Re: Strings and % sign fails - Help Please

2006-03-24 Thread Fredrik Lundh
Siah wrote: > Problem Solved. The problem was with psycopg.Binary whose mere job is > to convert bytes into clear text for sql statement. no, its job is to wrap strings that contain binary blobs, so that data binding works properly. you're supposed to do cursor.execute(statement, Binary(da

Re: Strings and % sign fails - Help Please

2006-03-24 Thread Siah
Problem Solved. The problem was with psycopg.Binary whose mere job is to convert bytes into clear text for sql statement. I'll be filing a bug. Thanks everyone, Sia -- http://mail.python.org/mailman/listinfo/python-list

Re: Strings and % sign fails - Help Please

2006-03-24 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > heh.. It works except I am using psycopg.Binary(somebinarystructure), > and I am not really doing it by hand to just add the extra %, and > psycopg.Binary doesn't do it. I'd imagine it's a bug with psycopg > package. or a bug in your use of Binary. what exactly are you

Re: Strings and % sign fails - Help Please

2006-03-23 Thread Christoph Zwerschke
Erik Max Francis wrote: > His problem is that cursor.execute does format expansion with %, so a > single % is not legal. Yes, I think psycopg uses paramstyle='pyformat', i.e. it expands parameters in your sql in the usual Python way where % has a special meaning. If you really mean the % sign o

Re: Strings and % sign fails - Help Please

2006-03-23 Thread Erik Max Francis
Jorge Godoy wrote: > I know. I'm just trying to see if there might be some magic going on with his > driver... Since raw strings have no effect on format specifiers, that won't tell you anything. >>> r'%' == '%' True His problem is that cursor.execute does format expansion with %, so a sin

Re: Strings and % sign fails - Help Please

2006-03-23 Thread Jorge Godoy
Erik Max Francis <[EMAIL PROTECTED]> writes: > Raw strings don't have anything to do with format specifiers. I know. I'm just trying to see if there might be some magic going on with his driver... -- Jorge Godoy <[EMAIL PROTECTED]> "Quidquid latine dictum sit, altum sonatur." - Qualquer

Re: Strings and % sign fails - Help Please

2006-03-23 Thread Erik Max Francis
Jorge Godoy wrote: > [EMAIL PROTECTED] writes: > >> heh.. It works except I am using psycopg.Binary(somebinarystructure), >> and I am not really doing it by hand to just add the extra %, and >> psycopg.Binary doesn't do it. I'd imagine it's a bug with psycopg >> package. Any quick way to project

Re: Strings and % sign fails - Help Please

2006-03-23 Thread Jorge Godoy
[EMAIL PROTECTED] writes: > heh.. It works except I am using psycopg.Binary(somebinarystructure), > and I am not really doing it by hand to just add the extra %, and > psycopg.Binary doesn't do it. I'd imagine it's a bug with psycopg > package. Any quick way to project a string from freak '%' pro

Re: Strings and % sign fails - Help Please

2006-03-23 Thread siasookhteh
heh.. It works except I am using psycopg.Binary(somebinarystructure), and I am not really doing it by hand to just add the extra %, and psycopg.Binary doesn't do it. I'd imagine it's a bug with psycopg package. Any quick way to project a string from freak '%' problems? Thanks, Sia Jorge Godoy w

Re: Strings and % sign fails - Help Please

2006-03-23 Thread Jorge Godoy
[EMAIL PROTECTED] writes: > The following statement fails because it has the '%' sign in it. > cursor.execute("select '%'") > > The error is: IndexError: list index out of range > > How do I address this problem? Use "%%". -- Jorge Godoy <[EMAIL PROTECTED]> "Quidquid latine dictum sit, a

Strings and % sign fails - Help Please

2006-03-23 Thread siasookhteh
I also posted this in Django Users group, but figured it probably has more relevance for python group. It seems like a freak problem to me. I spent a long hour to track the problem down and here it is: The following statement fails because it has the '%' sign in it. cursor.execute("select '%'")