Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
MySQL: AttributeError: cursor
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  2 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Kevin Murphy  
View profile  
 More options Feb 11, 12:40 pm
Newsgroups: comp.lang.python
From: Kevin Murphy <kevinmurphy9...@gmail.com>
Date: Sat, 11 Feb 2012 09:40:09 -0800 (PST)
Local: Sat, Feb 11 2012 12:40 pm
Subject: MySQL: AttributeError: cursor
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 must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Albert W. Hopkins  
View profile  
 More options Feb 11, 1:07 pm
Newsgroups: comp.lang.python
From: "Albert W. Hopkins" <mar...@letterboxes.org>
Date: Sat, 11 Feb 2012 13:07:25 -0500
Local: Sat, Feb 11 2012 1:07 pm
Subject: Re: MySQL: AttributeError: cursor

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

>>> import MySQLdb
>>> db = MySQLdb.connect(host='localhost', user='root', passwd='mypw',
db='python-test')
>>> cursor = db.cursor()

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

-a


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »