Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #28575
| From | Peter Otten <__peter__@web.de> |
|---|---|
| Subject | Re: Need help fixing this error please:NameError: global name is not defined |
| Date | 2012-09-06 13:07 +0200 |
| Organization | None |
| References | <149e9472-ec31-4b74-9f20-d4945a9fb678@googlegroups.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.292.1346929651.27098.python-list@python.org> (permalink) |
shaun wrote:
> 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:
> 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()
This is not your real code. The above would give you a SyntaxError in the
line
> cur.execute("SELECT * FROM name)
> 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
The offending line may not be indented correctly:
def databasebatchcall(...):
...
cur = con.cursor()
...
results = cur.fetchall()
This may be obscured by mixing tabs and spaces. However, without the actual
code this is nothing but a guess.
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