473,387 Members | 1,721 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,387 software developers and data experts.

AttributeError help

Hello folks, I wrote this code for connection module yesterday to extract data from an Oracle db and it worked - I was happy and went home for the evening thinking today I will write the rest of the program. However to my dismay, the same code does not work today and I am not sure what is the problem. Here is the code and the error:
>>> import cx_Oracle
>>> orc1=cx_Oracle.connect(connString)
>>> curs=orc1.cursor
>>> sql="SELECT COUNT(*) FROM PS_PEPTIDES WHERE RANK = 1"
>>> curs.execute(sql)
Traceback (most recent call last):
File "<pyshell#4>", line 1, in -toplevel-
curs.execute(sql)
AttributeError: 'builtin_function_or_method' object has no attribute 'execute'
I replaced the login information with dummy variable "connString"in the above code. Some help on the matter would be greatly appreciated - I tried to do google search and search on this board to see if I can find something that would help but was not successful.
Nov 29 '06 #1
5 8141
Well, this is embarassing but I figured out my problem:
curs=orc1.cursor
should be
curs=orc1.cursor()
I am surprised the original statement did not return an error but it works now!
Nov 29 '06 #2
bartonc
6,596 Expert 4TB
Well, this is embarassing but I figured out my problem:
curs=orc1.cursor
should be
curs=orc1.cursor()
I am surprised the original statement did not return an error but it works now!
This is not an error because python lets you do thinks like assign functions to variables. So
c=curs() would work after the above assignment.
Nov 29 '06 #3
bartonc
6,596 Expert 4TB
By the way, Welcome to the python forum. I hope you keep posting,
barton
Nov 29 '06 #4
I fear I will be visiting a lot.

Thanks!
Nov 30 '06 #5
bartonc
6,596 Expert 4TB
I fear I will be visiting a lot.

Thanks!
That's great!
Nov 30 '06 #6

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

Similar topics

0
by: seth | last post by:
Last week I encountered an AttributeError in my unit tests that I wasn'table to catch with an "except AttributeError" statement. The problem stemmed from a class that raised an error inside...
5
by: Reinhard Koenig | last post by:
Hello, I' m using Python 2.3, win32all-157 under W2K. I've applied the makepy utility for the Word 8.0 object library. I now receive: Python 2.3.1 (#47, Sep 23 2003, 23:47:32) on win32 Type...
2
by: GrelEns | last post by:
hello, i would like if this behaviour can be obtained from python : trap an attributeError from inside a subclassing dict class... (here is a silly examples to explain my question) class...
0
by: Erlend Fuglum | last post by:
I have tried and tried, but cannot figure out the source of the following error: AttributeError: 'module' object has no attribute 'menyHMTL' __doc__ = 'Attribute not found.' __getitem__ =...
2
by: rsd | last post by:
Hi, I'm trying get Samsung YH-920 mp3 player to work with Debian GNU/Linux. To do that I need to run http://www.paul.sladen.org/toys/samsung-yh-925/yh-925-db-0.1.py script, the idea behind the...
7
by: erikcw | last post by:
Hi, I'm trying to build a SQL string sql = """INSERT INTO ag ('cid', 'ag', 'test') VALUES(%i, %s, %d)""", (cid, ag, self.data) It raises this error: AttributeError: 'tuple' object has no...
2
by: Thomas Guettler | last post by:
Hi, how can you list the attributes of an object if you catch an AttributeError? I couldn't find a reference in the exception object, which points to the object. I want to call dir() on...
3
by: Juha S. | last post by:
I'm getting a "AttributeError: 'module' object has no attribute 'clock'" when importing a module from within two packages related to the line: "self.lastTime = time.clock()" in the __init__() of...
0
by: PlayDough | last post by:
I've embedded Python in an extension for a program we are using here at work. And I'm a bit stumped as to why I am getting an AttributeError only in the embedded Python. First, a bit of what I...
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: 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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.