473,382 Members | 1,424 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

mysql-python error "AttributeError: cursor"

2
My OS: Ubuntu 7.04 distribution
Mysql: Server version: 5.0.38-Ubuntu_0ubuntu1.2-log Ubuntu 7.04 distribution
mysql-python:1.2.2
python:2.5

when I run the following script:
import MySQLdb
conn = MySQLdb.connection('localhost', 'root', '', 'books');
c=conn.cursor()
cur = conn.cursor();
cur.execute('select * from orders');
row = cur.fetchone();
print row;


I get error message:
Traceback (most recent call last):
File "mysql_demo.py", line 7, in <module>
c=conn.cursor()
AttributeError: cursor

Please help!!!!
Mar 13 '08 #1
3 4471
jlm699
314 100+
I don't know alot about the MySQLdb module (only postgresql modules)... but a quick google of the documentation reveals the following...
http://dustman.net/andy/python/MySQL...3.html#MySQLdb
Read about the connect() function and how cursor is a member of an object returned by that function. I think you may not be actually establishing a connection when you use connection()
Mar 13 '08 #2
geddy
2
But the script run correctly on the other machine
Mar 14 '08 #3
jlm699
314 100+
But the script run correctly on the other machine
What is the difference between the two machines then? It can't be a problem with the code if it already runs.. it must be a problem with the machine itself.
Mar 14 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Cary | last post by:
Trying to install on SuSE 8.2 from source. ../configure --with-apxs=/usr/local/apache/bin/apxs --with-mysql --with-unixODBC=/usr/lib getting this error: /root/php-4.3.2/ext/odbc/php_odbc.c -o...
1
by: Wayno | last post by:
My php logs are coming up empty. I have done all I can think of, and all that made sense to me. Can someone take a look at my php.ini please and tell me what you think may be the problem. I...
10
by: r6uji7 | last post by:
hello, i am new to PHP programming and wondered if u could help. lets say i have the following files: 1. error.php: that is routed to for all errors. this page should display proper and...
13
by: deko | last post by:
I use this convention frequently: Exit_Here: Exit Sub HandleErr: Select Case Err.Number Case 3163 Resume Next Case 3376 Resume Next
7
by: p | last post by:
WE had a Crystal 8 WebApp using vs 2002 which we upgraded to VS2003. I also have Crystal 9 pro on my development machine. The web app runs fine on my dev machine but am having problems deploying....
2
by: f rom | last post by:
----- Forwarded Message ---- From: Josiah Carlson <jcarlson@uci.edu> To: f rom <etaoinbe@yahoo.com>; wxpython-users@lists.wxwidgets.org Sent: Monday, December 4, 2006 10:03:28 PM Subject: Re: ...
2
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I...
0
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I...
5
by: yashu0209 | last post by:
I have an error occurring when i try to compile the program and the error is: D:\Program Files\visual studio 6.0\MSDev98\MyProjects\GLEnabledView\GLNew.cpp(164) : error C2653: 'CGLEnabledView' :...
2
by: randa zaghdan | last post by:
Hi I have a problem with my program in vc 2008 When I compile it, the following errors are listed. I try to resolve it but no hope Does any one can help me ? thanks . Linking......
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.