MySQL: AttributeError: cursor

K

Kevin Murphy

Hi All,
I'm using Python 2.7 and having a problem creating the cursor below.
Any suggestions would be appreciated!

import sys
import _mysql

print "cursor test"

db =
_mysql.connect(host="localhost",user="root",passwd="mypw",db="python-
test")

cursor = db.cursor()
cursor test

Traceback (most recent call last):
File "C:\Python27\dbconnect.py", line 8, in <module>
cursor = db.cursor()
AttributeError: cursor
 
A

Albert W. Hopkins

Hi All,
I'm using Python 2.7 and having a problem creating the cursor below.
Any suggestions would be appreciated!

import sys
import _mysql

print "cursor test"

db =
_mysql.connect(host="localhost",user="root",passwd="mypw",db="python-
test")

cursor = db.cursor()

cursor test

Traceback (most recent call last):
File "C:\Python27\dbconnect.py", line 8, in <module>
cursor = db.cursor()
AttributeError: cursor

You are using the low-level C API wrapper (not sure why). Most people,
I believe, would use the pythonic API:

The low-level API is... well.. for when you want to do low-level stuff.
You probably want the pythonic API.

-a
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,046
Latest member
Gavizuho

Latest Threads

Top