[python-list] Problem with SQLObject

Guillermo Heizenreder gheize at gmail.com
Thu Oct 25 20:50:10 EDT 2007


I'm creating one aplicattion and I use SQLObject, but I have a little
problem, when I try to create one table my aplicattion crash! :(
Let me show you:

nercof at debian:~/Proyectos/ghhp/lib$ python
Python 2.4.4 (#2, Apr  5 2007, 20:11:18)
[GCC 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from sqlobject import *
>>> from connection import conn
>>> class User(SQLObject):
...     _connection = conn
...     user_name = StringCol(length=14, unique=True)
...     un_pass = StringCol(length=10)
...
>>> User.createTable()
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/lib/python2.4/site-packages/sqlobject/main.py", line 1332,
in createTable
    conn.createTable(cls)
  File "/usr/lib/python2.4/site-packages/sqlobject/dbconnection.py",
line 528, in createTable
    self.query(self.createTableSQL(soClass))
  File "/usr/lib/python2.4/site-packages/sqlobject/dbconnection.py",
line 307, in query
    return self._runWithConnection(self._query, s)
  File "/usr/lib/python2.4/site-packages/sqlobject/dbconnection.py",
line 219, in _runWithConnection
    conn = self.getConnection()
  File "/usr/lib/python2.4/site-packages/sqlobject/dbconnection.py",
line 230, in getConnection
    conn = self.makeConnection()
  File
"/usr/lib/python2.4/site-packages/sqlobject/mysql/mysqlconnection.py",
line 51, in makeConnection
    db=self.db, user=self.user, passwd=self.password, **self.kw)
  File "/usr/lib/python2.4/site-packages/MySQLdb/__init__.py", line 75,
in Connect
    return Connection(*args, **kwargs)
  File "/usr/lib/python2.4/site-packages/MySQLdb/connections.py", line
164, in __init__
    super(Connection, self).__init__(*args, **kwargs2)
TypeError: an integer is required
>>>

I can't find the mistake. 
First I thought that not create correctly the conection to mysql, but
testening show me this:

>>> User._connection
<sqlobject.mysql.mysqlconnection.MySQLConnection instance at 0xb784df8c>
>>>

Saw it seems that it works.
Please cant you help me.
Thank's and regards

-- 
+---------------------------------
| Heizenreder Guillermo 
| http://gheize.wordpress.com/
| http://code.google.com/u/gheize/
| http://tipslinux.blogspot.com/
+---------------------------------




More information about the Python-list mailing list