Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #28578
| Path | csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <rosuav@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.013 |
| X-Spam-Evidence | '*H*': 0.97; '*S*': 0.00; 'subject:help': 0.07; 'python': 0.09; 'name)': 0.09; 'sep': 0.09; 'def': 0.10; 'subject:error': 0.11; 'subject:not': 0.11; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'variable.': 0.16; 'wrote:': 0.17; 'thu,': 0.17; 'received:209.85.214.174': 0.21; 'skip:c 70': 0.22; 'sets': 0.23; 'header:In-Reply-To:1': 0.25; 'looks': 0.26; 'subject:please': 0.27; 'message- id:@mail.gmail.com': 0.27; 'all.': 0.28; 'probably': 0.29; 'class': 0.29; "skip:' 10": 0.30; 'problem.': 0.32; 'maintained': 0.33; 'to:addr:python-list': 0.33; 'received:google.com': 0.34; 'pm,': 0.35; 'received:209.85': 0.35; 'really': 0.36; 'but': 0.36; 'should': 0.36; 'does': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'received:209.85.214': 0.39; 'where': 0.40; 'header:Received:5': 0.40; 'your': 0.60; 'subject:Need': 0.61; 'results': 0.65; 'state,': 0.65; 'subject::': 0.83; 'subject:this': 0.84 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=EcIsZwoN/2tTSan7FzydG92RQ0DfJDoF1RqHLWUjdac=; b=WLVfCLcKdxuDzI3gJ2daDKeTchNa2DJDeiB37wTQUaLPSlNYLBL3C4zGVUm/FKlyCc M2z3a0yLF8+3B2eJXjc1y49NmO2VKX7cO1VlV8U6Ku/z/XfPO8MMf8Q2dR/CKWTjJBQD x8KSKG7rGkb2vNTNdZTuPdYZbg7h21HHDlPjTxRrJY+nEOUmPeMnH7IOW/MjRxm5GbUv uGkwOWsGA43eVcTJubvMP3UZ3bluQScCHJDTxQuiQHpoFvh+OTS7sG07r29l2DHnQjF6 LGUWKDhbzANgNnww74SRof+t0U2My/WYpCHurP2e1gkPDYWoVZxtRyTgZi2txBW9FWLo 039Q== |
| MIME-Version | 1.0 |
| In-Reply-To | <42718e31-d77b-4c8a-ae48-1dae0a780585@googlegroups.com> |
| References | <149e9472-ec31-4b74-9f20-d4945a9fb678@googlegroups.com> <42718e31-d77b-4c8a-ae48-1dae0a780585@googlegroups.com> |
| Date | Thu, 6 Sep 2012 21:53:57 +1000 |
| Subject | Re: Need help fixing this error please:NameError: global name is not defined |
| From | Chris Angelico <rosuav@gmail.com> |
| To | python-list@python.org |
| Content-Type | text/plain; charset=ISO-8859-1 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.295.1346932440.27098.python-list@python.org> (permalink) |
| Lines | 20 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1346932440 news.xs4all.nl 6951 [2001:888:2000:d::a6]:32769 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:28578 |
Show key headers only | View raw
On Thu, Sep 6, 2012 at 9:37 PM, shaun <shaun.wiseman91@gmail.com> wrote:
> class StringCall:
> results=[]
> def databasebatchcall(self,termid, batchid):
> con = cx_Oracle.connect('user/user123@odb4.dcc.company.ie/ODB4TEST.COMPANY.IE')
> cur = con.cursor()
> cur.execute("SELECT * from name)
> results = cur.fetchall()
This actually never sets 'results', which is a class variable. You
should probably be using 'self.results' here; Python does not include
class/instance members in scope automatically.
Try using 'self.' for everything that you need to be maintained as
state, and see if that solves your problem.
But this looks to me like a case where you may not really even need a
class at all.
ChrisA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Need help fixing this error please:NameError: global name is not defined shaun <shaun.wiseman91@gmail.com> - 2012-09-06 03:45 -0700
Re: Need help fixing this error please:NameError: global name is not defined Chris Angelico <rosuav@gmail.com> - 2012-09-06 21:05 +1000
Re: Need help fixing this error please:NameError: global name is not defined Dave Angel <d@davea.name> - 2012-09-06 07:05 -0400
Re: Need help fixing this error please:NameError: global name is not defined Peter Otten <__peter__@web.de> - 2012-09-06 13:07 +0200
Re: Need help fixing this error please:NameError: global name is not defined Chris Angelico <rosuav@gmail.com> - 2012-09-06 21:53 +1000
Re: Need help fixing this error please:NameError: global name is not defined shaun <shaun.wiseman91@gmail.com> - 2012-09-06 05:07 -0700
Re: Need help fixing this error please:NameError: global name is not defined Chris Angelico <rosuav@gmail.com> - 2012-09-06 23:16 +1000
Re: Need help fixing this error please:NameError: global name is not defined MRAB <python@mrabarnett.plus.com> - 2012-09-06 13:08 +0100
Re: Need help fixing this error please:NameError: global name is not defined Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-09-06 17:16 -0400
csiph-web