Menu

cursor error

Help
Jason Wang
2009-02-11
2012-09-19
  • Jason Wang

    Jason Wang - 2009-02-11

    Hi all, i tried to run the following:
    >>> import MySQLdb
    >>> db = MySQLdb.connection(user="root", db="test")
    >>> db.cursor()

    Traceback (most recent call last):
    File "<pyshell#2>", line 1, in <module>
    db.cursor()
    AttributeError: cursor
    >>>

    Can someone tell me what could be wrong with that?

    I'm running python 2.5 on mac intel with the latest release of mysqldb (as of 2 weeks ago)

    thanks a lot!

    Jason

     
    • Jason Wang

      Jason Wang - 2009-02-11

      thanks a lot!

      for some reason i read a random code snippet online about MySQLdb and just copied some of their initialization stuff...

      it fixed my problem :D

       
    • Leo Hourvitz

      Leo Hourvitz - 2009-02-11

      I think the problem is that you want to call connect(), not connection():
      conn = MySQLdb.connect(...)
      See PEP249. I'm not sure what connection() gives you but it appears to be something else...

      Leo

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.