I have a piece of code that work fine on a server and don't work on other server ( Linux servers)
import psycopg2,psycopg2.extras
conn = psycopg2.connect("host=xx.x.x.x dbname=dev user=user password=pass" )
parentId='272'
dbCur = conn.cursor(cursor_factory=psycopg2.extras.NamedTupleCursor)
dbCur.execute('select * from "treeItem" where "parentId" = %s order by "order"',(parentId,))
for row in dbCur:
print type(row)
print row.__dict__
vars(row)
dbCur.close()
conn.close()
The output on the server error is :
class 'psycopg2.extras.Record'
Traceback (most recent call last):
File "test1.py", line 8, in <module>
print row.__dict__
AttributeError: 'Record' object has no attribute '__dict__'
but it work on the other server without problem. Same version of python (2.7) and psycopg2 2.5
How class psycopg2.extras.Record can have __dict__
on an environment and not in other?
Edit
Work on python 2.7.3 and psycopg2 2.5 (dt dec pq3 ext)
Dont work on python 2.7.5 psycopg2 2.5.1 (dt dec pq3 ext)