Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!ecngs!feeder2.ecngs.de!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.006 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; '21,': 0.07; 'filename': 0.07; 'subject:help': 0.07; 'python': 0.09; 'method:': 0.09; 'name)': 0.09; 'nameerror:': 0.09; 'cc:addr:python-list': 0.10; 'def': 0.10; 'subject:error': 0.11; 'subject:not': 0.11; 'should.': 0.16; 'subject: \n ': 0.16; 'those,': 0.16; 'wrote:': 0.17; 'skip:" 30': 0.20; 'all,': 0.21; 'occurs': 0.22; 'skip:c 70': 0.22; 'defined': 0.22; 'cc:2**0': 0.23; 'cc:no real name:2**0': 0.24; 'idea': 0.24; 'script': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header :User-Agent:1': 0.26; 'am,': 0.27; 'appreciated': 0.27; 'subject:please': 0.27; 'run': 0.28; 'skip:/ 40': 0.29; 'source': 0.29; 'class': 0.29; "i'm": 0.29; 'function': 0.30; 'error': 0.30; 'file': 0.32; 'function.': 0.33; 'stands': 0.33; 'skip:d 20': 0.34; 'thanks': 0.34; 'similar': 0.35; 'really': 0.36; 'but': 0.36; 'subject:: ': 0.38; 'object': 0.38; 'gives': 0.39; 'received:192': 0.39; 'notice': 0.39; 'received:192.168': 0.40; 'help': 0.40; 'subject:Need': 0.61; 'different': 0.63; 'show': 0.63; 'results': 0.65; 'header:Reply-To:1': 0.68; 'received:74.208': 0.71; 'reply-to:no real name:2**0': 0.72; '>from': 0.75; 'subject::': 0.83; 'subject:this': 0.84; 'received:74.208.4.194': 0.84; 'skip:/ 30': 0.91 Date: Thu, 06 Sep 2012 07:05:43 -0400 From: Dave Angel User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120714 Thunderbird/14.0 MIME-Version: 1.0 To: shaun Subject: Re: Need help fixing this error please:NameError: global name is not defined References: <149e9472-ec31-4b74-9f20-d4945a9fb678@googlegroups.com> In-Reply-To: <149e9472-ec31-4b74-9f20-d4945a9fb678@googlegroups.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Provags-ID: V02:K0:MABCSKUpTX9HfuFVnm7N+F4gYYzU/GsnkLNb3/Yl7Px Y+hQCKtxRqZvaVJ8NL7pYvb0j0jw4aCfMn4kVk4UsQ2aMzkyT7 Ul7Fgweni1+KWhz8OVLAn9CZ6aFIN6B9cwAByxjoQAHN0MxEbi TfddhtLizb95r/hkp+XR1T7jk+3mQs9o6j6xk8086BUEJVHNjs cNuWL5jUyG1nJr7kyUHwcwTe/AM/SQ3y3teqGwGuQnWqO8kWNz gyBDyhMtbcoItDotsWRctOP5ShNMvo6yYu1oOhoX6aGyfvyRW3 jJEuT7uYXOrICjquGQkl7SV2ocYh9C8igJ6KmHDb0FKUGUt+Q= = Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: d@davea.name List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 40 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1346929564 news.xs4all.nl 6954 [2001:888:2000:d::a6]:37897 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:28574 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/user123@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