Switching Databases

Victor Subervi victorsubervi at gmail.com
Mon Nov 23 16:26:57 CET 2009


On Mon, Nov 23, 2009 at 10:08 AM, Carsten Haese <carsten.haese at 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 that fixes the problem.
>

That gave me the idea that I should simply open two separate connections.
Here's the error that got thrown with the second connection:

A problem occurred in a Python script. Here is the sequence of function
calls leading up to the error, in the order they occurred.
  /var/www/html/angrynates.com/cart/createProducts2.py   117 </body>
   118 </html>
   119 '''
   120
   121 createProducts2()
 *createProducts2* = <function createProducts2>
/var/www/html/angrynates.com/cart/createProducts2.py in *createProducts2*()
   35       sst.append(bits[2])
    36       sstp.append(bits[1])
    37   db2 = MySQLdb.connect(host, user, passwd, db)
    38   cursor2 = db.cursor()
    39   created = []
 db2 *undefined*, *global* *MySQLdb* = <module 'MySQLdb' from
'/usr/lib64/python2.4/site-packages/MySQLdb/__init__.pyc'>, MySQLdb.*connect
* = <function Connect>, *host* = 'localhost', *user* = 'beno', *passwd* =
'Kj9rg2', *db* = <_mysql.connection open to 'localhost' at 28772c0>
/usr/lib64/python2.4/site-packages/MySQLdb/__init__.py in
*Connect*(*args=('localhost',
'beno', 'Kj9rg2', <_mysql.connection open to 'localhost' at 28772c0>),
**kwargs={})    73     """Factory function for connections.Connection."""
    74     from connections import Connection
    75     return Connection(*args, **kwargs)
    76
    77 connect = Connection = Connect
 *Connection* = <class 'MySQLdb.connections.Connection'>, *args* =
('localhost', 'beno', 'Kj9rg2', <_mysql.connection open to 'localhost' at
28772c0>), *kwargs* = {}
/usr/lib64/python2.4/site-packages/MySQLdb/connections.py in
*__init__*(self=<_mysql.connection
closed at 28d95c0>, *args=('localhost', 'beno', 'Kj9rg2', <_mysql.connection
open to 'localhost' at 28772c0>), **kwargs={})   162
         kwargs2['client_flag'] = client_flag
   163
   164         super(Connection, self).__init__(*args, **kwargs2)
   165
   166         self.encoders = dict([ (k, v) for k, v in conv.items()
 *builtin* *super* = <type 'super'>, *global* *Connection* = <class
'MySQLdb.connections.Connection'>, *self* = <_mysql.connection closed at
28d95c0>, ).*__init__* = <bound method Connection.__init__ of
<_mysql.connection closed at 28d95c0>>, *args* = ('localhost', 'beno',
'Kj9rg2', <_mysql.connection open to 'localhost' at 28772c0>), *kwargs2* =
{'client_flag': 196608, 'conv': {0: <class 'decimal.Decimal'>, 1: <type
'int'>, 2: <type 'int'>, 3: <type 'long'>, 4: <type 'float'>, 5: <type
'float'>, 7: <function mysql_timestamp_converter>, 8: <type 'long'>, 9:
<type 'int'>, 10: <function Date_or_None>, ...}}*TypeError*: connect()
argument 4 must be string, not Connection
      args = ('connect() argument 4 must be string, not Connection',)

TIA,
V
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20091123/c0113bae/attachment.html>


More information about the Python-list mailing list