Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Nov 15th, 2012  |  syntax: None  |  size: 0.67 KB  |  views: 32  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. con=MySQLdb.connect(host='localhost', user='test', passwd='xx', db='yy')
  2. curs = con.cursor(MySQLdb.cursors.CursorUseResultMixIn)
  3.        
  4. File "C:Python26libsite-packagesMySQLdbconnections.py", line 226, in cursor
  5.     return (cursorclass or self.cursorclass)(self)
  6. TypeError: object.__new__() takes no parameters
  7.        
  8. class SSCursor(CursorUseResultMixIn, CursorTupleRowsMixIn,
  9.                BaseCursor):
  10.  
  11.     """This is a Cursor class that returns rows as tuples and stores
  12.     the result set in the server."""
  13.        
  14. import MySQLdb.cursors as cursors
  15. con = MySQLdb.connect(host = 'localhost', user = 'test', passwd = 'xx',
  16.                            db = 'yy', cursorclass = cursors.SSCursor)
clone this paste RAW Paste Data