On 09/06/2012 06:45 AM, shaun wrote: > Hi all, > > I have a class which I create an object from in a different script but when > its run I get an error at the last part of this method: > > ////CODE/////////////////////////////// > > def databasebatchcall(self,tid, bid): > > con=cx_Oracle.connect('user/user...@odb4.dcc.company/ODB4TEST.COMPANY.COM') > cur = con.cursor() > cur.execute("SELECT * FROM name) > results = cur.fetchall() > ////////////////////////////////////////// > > >From this last line I get the following error which I don't understand I'm > >very new to python and have no idea about this any help would be appreciated > > > ////////////////////////////////////////////// > > File "/home/dcroke/mdcFDACStringCall.py", line 21, in fetchbatchdata > results = cur.fetchall() > NameError: global name 'cur' is not defined > > ////////////////////////////////////////////// > > > Thanks all, > Shaun
is that really the function in line 21, or is it just a similar line? Notice the error gives you filename & line number. I have no way to check either of those, but you can and should. What really stands out is the function name the error occurs in: fetchbatchdata() You don't show us the source to that function. -- DaveA -- http://mail.python.org/mailman/listinfo/python-list