Re: Switching Databases

2009-11-23 Thread Terry Reedy
Victor Subervi wrote: A problem occurred in a Python script. Here is the sequence of function calls leading up to the error, in the order they occurred. [snip hmtl error report] Please post plain text - ascii or utf8. On my newsreader, what you posted, with a mismash of colors, bold, italic,

Re: Switching Databases

2009-11-23 Thread Victor Subervi
On Mon, Nov 23, 2009 at 10:59 AM, Carsten Haese wrote: > Have you tried to *read* and *understand* this error message? My guess > is no. The error message tells you all you need to know. You need to > pass a string as argument 4, but you aren't. <> is a database > connection object, not a string.

Re: Switching Databases

2009-11-23 Thread Carsten Haese
Victor Subervi wrote: > On Mon, Nov 23, 2009 at 10:08 AM, Carsten Haese > wrote: > > As I said, the best way we can help you is if you copy the actual error > message so that we may diagnose the actual problem and suggest a > solution that fixes the pro

Re: Switching Databases

2009-11-23 Thread Victor Subervi
On Mon, Nov 23, 2009 at 10:08 AM, Carsten Haese wrote: > As I said, the best way we can help you is if you copy the actual error > message so that we may diagnose the actual problem and suggest a > solution that fixes the problem. > That gave me the idea that I should simply open two separate con

Re: Switching Databases

2009-11-23 Thread Carsten Haese
Victor Subervi wrote: > On Mon, Nov 23, 2009 at 9:17 AM, Carsten Haese > wrote: > > You thought you did, but did you? The code snippet above doesn't show > any code that closes a database connection. > > > Would you be so kind as to tell me exactly what c

Re: Switching Databases

2009-11-23 Thread Victor Subervi
On Mon, Nov 23, 2009 at 9:17 AM, Carsten Haese wrote: > You thought you did, but did you? The code snippet above doesn't show > any code that closes a database connection. > Would you be so kind as to tell me exactly what code *does* close a database, then? That would solve this handily. Other th

Re: Switching Databases

2009-11-23 Thread Carsten Haese
Victor Subervi wrote: > Hi; > I have the following code: > > import MySQLdb > ... > user, passwd, db, host = login() > db = MySQLdb.connect(host, user, passwd, 'cart') > cursor= db.cursor() > ... > cursor.close() > db = MySQLdb.connect(host, user, passwd, db) > cursor= db.cursor() > > Now, python

Switching Databases

2009-11-23 Thread Victor Subervi
Hi; I have the following code: import MySQLdb ... user, passwd, db, host = login() db = MySQLdb.connect(host, user, passwd, 'cart') cursor= db.cursor() ... cursor.close() db = MySQLdb.connect(host, user, passwd, db) cursor= db.cursor() Now, python complains about me opening a new connection. But