Thread: Python and 8.0 beta
Are there any python drivers that work with the version 8 beta? The version seven ones didn't. Thanks, Tim
Tim Penhey wrote: > Are there any python drivers that work with the version 8 beta? > The version seven ones didn't. Why? -- Peter Eisentraut http://developer.postgresql.org/~petere/
> Are there any python drivers that work with the version 8 beta? > > The version seven ones didn't. This script is working with version 7.4.2, FC2, python 2.3.3 #! /usr/bin/env python import pgdb db = pgdb.connect(dsn="localhost:ksDesenv") cursor = db.cursor() cursor.execute("select * from times()") rsTimes = cursor.fetchall() for lTime in rsTimes: i = 0 # print str(lTime[0]) cursor.execute("select * from usuarios_do_time(" + str(lTime[0]) + ")") rsMembros = cursor.fetchall() for lMembro in rsMembros: f = open('/var/www/html/kakaostats/u' + str(lMembro[0]) + '.txt', 'w') f.write(repr(lMembro[1]) + ';' + str(lMembro[2]) + ';' + lMembro[5] + '\n') i += 1 # print i, lTime[0], lMembro rank = lMembro[4] cursor.execute("select * from concorrentes_de_um_usuario(" + str(lTime[0]) + "," + str(lMembro[2]) + "," + str(lMembro[3]) + "," + str(rank) + ")") rsConcorrentes = cursor.fetchall() for lConcorrente in rsConcorrentes: if lMembro[2] - lMembro[3] > lConcorrente[6] - lConcorrente[7] and lMembro[4] > lConcorrente[4]: rank -= 1 rg = 'g' else: rank += 1 rg = 'r' f.write(str(rank) + ";") for campo in lConcorrente: f.write(repr(campo) + ';') f.write(rg + '\n') # print rank, lConcorrente, rg f.close() # print raw_input(":") cursor.close() db.close() Regards, Clodoaldo Pinto _______________________________________________________ Yahoo! Acesso Grátis - navegue de graça com conexão de qualidade! http://br.acesso.yahoo.com/
Peter Eisentraut wrote: >Tim Penhey wrote: > > >>Are there any python drivers that work with the version 8 beta? >>The version seven ones didn't. >> >> > >Why? > > Changed from using pyPgSQL to psycopg and things are working again... Tim
On Tue, Aug 24, 2004 at 12:12:35AM +0100, Tim Penhey wrote: > Peter Eisentraut wrote: > > >Tim Penhey wrote: > > > >>Are there any python drivers that work with the version 8 beta? > >>The version seven ones didn't. > > > >Why? > > > Changed from using pyPgSQL to psycopg and things are working again... Switching modules may fix your code but it doesn't fix the problem with pyPgSQL. I'm guessing that your code was failing with an exception like the following: libpq.DatabaseError: Ivalid [sic] format for PgVersion construction. pyPgSQL's version string parsing fails at the "beta" portion of "8.0.0beta1". This has already been reported at Sourceforge as Bug 1006782; I just followed up to that bug report with a suggested fix. -- Michael Fuhr http://www.fuhr.org/~mfuhr/
Clodoaldo Pinto Neto wrote: >>Are there any python drivers that work with the version 8 beta? >> >>The version seven ones didn't. > > > This script is working with version 7.4.2, FC2, python 2.3.3 > > [SNIP] May you test the following script and let me know which error you are encountering: #!/usr/bin/python import pgdb if ( __name__ == "__main__") : connection = pgdb.connect( user = 'user', password = 'password', host = '127.0.0.1', database = 'database') if ( connection == None): raise "Could Not Connect" cursor = connection.cursor() cursor.execute ( 'select version()' ) result = cursor.fetchall() cursor.close() while ( type(result) is type([]) ): result = result[ 0 ] print result this is working correctly on my 8.0beta1 installation Regards Gaetano Mendola