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

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 complains

Re: Switching Databases

2009-11-23 Thread Victor Subervi
On Mon, Nov 23, 2009 at 9:17 AM, Carsten Haese carsten.ha...@gmail.comwrote: 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

Re: Switching Databases

2009-11-23 Thread Carsten Haese
Victor Subervi wrote: On Mon, Nov 23, 2009 at 9:17 AM, Carsten Haese carsten.ha...@gmail.com mailto:carsten.ha...@gmail.com 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

Re: Switching Databases

2009-11-23 Thread Victor Subervi
On Mon, Nov 23, 2009 at 10:08 AM, Carsten Haese carsten.ha...@gmail.comwrote: 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

Re: Switching Databases

2009-11-23 Thread Carsten Haese
Victor Subervi wrote: On Mon, Nov 23, 2009 at 10:08 AM, Carsten Haese carsten.ha...@gmail.com mailto:carsten.ha...@gmail.com 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

Re: Switching Databases

2009-11-23 Thread Victor Subervi
On Mon, Nov 23, 2009 at 10:59 AM, Carsten Haese carsten.ha...@gmail.comwrote: 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. db is a database connection

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,