Hi Alan, On 1/18/06, Alan Franzoni <[EMAIL PROTECTED]> wrote: > Il Wed, 18 Jan 2006 14:39:09 -0500, Bernard Lebel ha scritto: > 1) It would be great if you didn't post four messages in less than an hour > ^_^
Yeah I know :-) But like I said, I've been stuck for 3 days on that, so, I need to get things off my chest. Sorry to anyone that got a smell of spam :-) > 2) Your code is very long! You can't expect many people to run and read it > all! You should post a very small demo program with the very same problem > as your main software. It'll help us a lot. Okay thanks for the advice. I have done what you have suggested. In this first example, I fetch an integer value from the database table. So far so good. However, if I change this value, the script keeps printing the same value over and over, eternally. Notic that everytime the while loop performs an iteration, a new cursor object is created, as you suggested. if __name__ == '__main__': oConnection = MySQLdb.connect( host = '192.168.10.101', user = 'render', passwd = 'rnrender', db = 'RenderFarm_BETA' ) sQuery = "SELECT LogLevel FROM TB_RENDERNODES WHERE ID = 108" while 1: oCursor = oConnection.cursor() oCursor.execute( sQuery ) oResult = oCursor.fetchone() print oResult oCursor.close() print 'waiting 5 seconds' time.sleep( 5 ) In the next one, I close the connection and create a new one. At that point, the script prints the right value when I change it in the database. if __name__ == '__main__': sQuery = "SELECT LogLevel FROM TB_RENDERNODES WHERE ID = 108" while 1: oConnection = MySQLdb.connect( host = '192.168.10.101', user = 'render', passwd = 'rnrender', db = 'RenderFarm_BETA' ) oCursor = oConnection.cursor() oCursor.execute( sQuery ) oResult = oCursor.fetchone() print oResult oCursor.close() oConnection.close() print 'waiting 5 seconds' time.sleep( 5 ) So I suspected that it had something to do with the threaded queue, but I can see it's not, since the examples above are not using it at all. Btw I did not expect anyone to run through the code, but just in case someone spotted something fishy... :-) > 3) IMHO your problem looks like something related to isolation levels. You > should check with your DB-adapter docs about the issue. You may need to > manually sync/commit the connection or the cursor. Instead of re-creating > the connection, have you tried just creating a new cursor object at every > query? > > If you want to do a quick-test, try any ORM, like sqlalchemy or sqlobject, > and check the results. Okay I'll check these out. Thanks Bernard -- http://mail.python.org/mailman/listinfo/python-list