Johannes Bauer wrote:
> On 30.03.2018 13:25, Johannes Bauer wrote:
>
>>> This mention of collections refers to ...
>>>
}
for (_, collections) in z.items():
>>>
>>> ... this local variable.
>>
>> Yup, but why? I mean, at the point of definition of "z", the only
>> definition of "collect
On 30.03.2018 16:46, Ben Bacarisse wrote:
>> Yup, but why? I mean, at the point of definition of "z", the only
>> definition of "collections" that would be visible to the code would be
>> the globally imported module, would it not? How can the code know of the
>> local declaration that only comes
On 3/30/2018 7:25 AM, Johannes Bauer wrote:
On 30.03.2018 13:13, Ben Bacarisse wrote:
import collections
class Test(object):
def __init__(self):
z = {
"y": collections.defaultdict(list),
This mention of collections refers to ...
Johannes Bauer writes:
> On 30.03.2018 13:13, Ben Bacarisse wrote:
>
>>> import collections
>>>
>>> class Test(object):
>>> def __init__(self):
>>> z = {
>>> "y": collections.defaultdict(list),
>>
>> This mention of collections refers to ...
>>
>>>
On 30.03.2018 13:25, Johannes Bauer wrote:
>> This mention of collections refers to ...
>>
>>> }
>>> for (_, collections) in z.items():
>>
>> ... this local variable.
>
> Yup, but why? I mean, at the point of definition of "z", the only
> definition of "collections" that w
On Fri, Mar 30, 2018 at 9:24 PM, Johannes Bauer wrote:
> Hey group,
>
> I stumbled about something that I cannot quite explain while doing some
> stupid naming of variables in my code, in particular using "collections"
> as an identifier. However, what results is strange. I've created a
> minimal
On 30.03.2018 13:13, Ben Bacarisse wrote:
>> import collections
>>
>> class Test(object):
>> def __init__(self):
>> z = {
>> "y": collections.defaultdict(list),
>
> This mention of collections refers to ...
>
>> }
>> for (_, collec
> In my opinion, this should run. However, this is what happens on Python
> 3.6.3 (default, Oct 3 2017, 21:45:48) [GCC 7.2.0] on linux):
>
> Traceback (most recent call last):
> File "x.py", line 11, in
> Test()
> File "x.py", line 6, in __ini
t happens on Python
3.6.3 (default, Oct 3 2017, 21:45:48) [GCC 7.2.0] on linux):
Traceback (most recent call last):
File "x.py", line 11, in
Test()
File "x.py", line 6, in __init__
"y": collections.defaultdict(list),
UnboundLocalError: local variable 'coll
On 3/19/2015 4:23 AM, Chris Kavanagh wrote:
On Wednesday, March 18, 2015 at 5:37:53 PM UTC-4, Terry Reedy wrote:
You comment out apparently irrelevant lines and see if you still have
the same problem, and if you do, delete. Repeat until you have a
Minimal Complete Verifiable Example.
Thank
On Wednesday, March 18, 2015 at 5:37:53 PM UTC-4, Terry Reedy wrote:
> On 3/18/2015 3:42 PM, Chris Kavanagh wrote:
>
> > 2nd, you say you "don't want to play guessing games", yet complain
> > about "300 lines of irrelevant code", lol. Which way is it? Do you
> > want the code, or not? How do I kno
On Wednesday, March 18, 2015 at 5:50:49 PM UTC-4, Mark Lawrence wrote:
> On 18/03/2015 19:42, Chris Kavanagh wrote:
> >
> > 2nd, you say you "don't want to play guessing games", yet complain about
> > "300 lines of irrelevant code", lol. Which way is it? Do you want the code,
> > or not? How do
On Wednesday, March 18, 2015 at 6:38:48 PM UTC-4, Steven D'Aprano wrote:
> On Thu, 19 Mar 2015 06:42 am, Chris Kavanagh wrote:
>
> > While I appreciate the help greatly I thought I had put the entire
> > traceback of the error. I was posting here and on StackOverflow, and
> > suppose I got confuse
On Thu, 19 Mar 2015 06:42 am, Chris Kavanagh wrote:
> While I appreciate the help greatly I thought I had put the entire
> traceback of the error. I was posting here and on StackOverflow, and
> suppose I got confused.
We all make mistakes. I got distracted and forgot to link you to
http://sscce
On 18/03/2015 19:42, Chris Kavanagh wrote:
2nd, you say you "don't want to play guessing games", yet complain about "300
lines of irrelevant code", lol. Which way is it? Do you want the code, or not? How do I know
what's relevant or irrelevant when I'm clearly confused? On Stack, if you don'
On 3/18/2015 3:42 PM, Chris Kavanagh wrote:
2nd, you say you "don't want to play guessing games", yet complain
about "300 lines of irrelevant code", lol. Which way is it? Do you
want the code, or not? How do I know what's relevant or irrelevant
when I'm clearly confused?
You comment out appare
ad of an Int) the showinfo dialogue box
> > opens as it should, but when the user clicks "ok" in the box, I get the
> > error "UnboundLocalError: local variable 'age' referenced before
> > assignment".
>
> As much as I love guessing games, I re
or:
> showinfo("Error:", "Please Enter A Number In Age Field.")
>
> If the user inputs a string (instead of an Int) the showinfo dialogue box
> opens as it should, but when the user clicks "ok" in the box, I get the
> error "UnboundL
showinfo dialogue
> > box opens as it should, but when the user clicks "ok" in the box, I get
> > the error "UnboundLocalError: local variable 'age' referenced before
> > assignment". I tried using a default value above the try: except clause
> > (age=0), wh
ter A Number In Age Field.")
If the user inputs a string (instead of an Int) the showinfo dialogue
box opens as it should, but when the user clicks "ok" in the box, I get
the error "UnboundLocalError: local variable 'age' referenced before
assignment". I tried using
ts a string (instead of an Int) the showinfo dialogue box
opens as it should, but when the user clicks "ok" in the box, I get the
error "UnboundLocalError: local variable 'age' referenced before
assignment". I tried using a default value above the try: except clause
(a
> That might be an indication of good code design :)
Or he got lucky and all his previous globals were mutable. :)
Skip
--
https://mail.python.org/mailman/listinfo/python-list
On Fri, Jan 31, 2014 at 10:05 PM, Marc Aymerich wrote:
> I can't believe, all these years using Python and never encountered a
> situation where I needed to use global !
That might be an indication of good code design :)
ChrisA
--
https://mail.python.org/mailman/listinfo/python-list
On Thu, Jan 30, 2014 at 11:53 PM, Chris Angelico wrote:
> On Fri, Jan 31, 2014 at 9:46 AM, Marc Aymerich wrote:
>> GLOBAL = 0
>>
>> def update():
>> GLOBAL += 1
>
> If you assign to a name, Python makes it local, unless you explicitly
> tell it that you want it to be global:
>
> def update():
"help", "copyright", "credits" or "license" for more information.
import globalstate
globalstate.update()
Traceback (most recent call last):
File "", line 1, in
File "globalstate.py", line 4, in update
GLOBAL += 1
UnboundLocalError: l
"help", "copyright", "credits" or "license" for more information.
import globalstate
globalstate.update()
Traceback (most recent call last):
File "", line 1, in
File "globalstate.py", line 4, in update
GLOBAL += 1
UnboundLocalError: l
On Fri, Jan 31, 2014 at 9:46 AM, Marc Aymerich wrote:
> GLOBAL = 0
>
> def update():
> GLOBAL += 1
If you assign to a name, Python makes it local, unless you explicitly
tell it that you want it to be global:
def update():
global GLOBAL
GLOBAL += 1
But be aware that the ALL_CAPS name
credits" or "license" for more information.
>>> import globalstate
>>> globalstate.update()
Traceback (most recent call last):
File "", line 1, in
File "globalstate.py", line 4, in update
GLOBAL += 1
UnboundLocalError: local variable 'GL
In Dave Angel
writes:
> > The problem is that change() isn't being executed here; instead it's being
> > executed from within root.mainloop(), whenever the user presses button-1.
> >
> > And within root.mainloop(), there is no variable called isWhite.
> >
> Actually that's irrelevant. Whether
isWhite = False
else:
w.itemconfig(rect, fill="white")
isWhite = True
w.bind("", change)
root.mainloop()
The problem occurs when clicking on the white square. The following error
appears:
"if isWhite:
UnboundLocalError: local
On 24 June 2013 21:19, wrote:
> Thank's to you all!
>
> Setting isWhite as global worked fine.
> I'll probably be back soon with another silly question, see you then :)
By the way, it's normally bad to use globals like this. When you're
learning it's something you just do, though; it's fine for
On 24 June 2013 21:12, John Gordon wrote:
> Since you're new to programming, this might be a bit tricky to explain,
> but I'll do my best. :-)
>
> The problem is that change() isn't being executed here; instead it's being
> executed from within root.mainloop(), whenever the user presses button-1.
Here's a little test to make sure you understand (this is one of the
most confusing parts of Python's closures in my opinion):
foo = "I'm foo!"
def working():
print(foo)
def broken():
print(foo)
if False: # There's no way this could cause a problem!
foo = "This will *never*
Thank's to you all!
Setting isWhite as global worked fine.
I'll probably be back soon with another silly question, see you then :)
--
http://mail.python.org/mailman/listinfo/python-list
isWhite = False
> else:
> w.itemconfig(rect, fill="white")
> isWhite = True
>
> w.bind("", change)
>
> root.mainloop()
> The problem occurs when clicking on the white square. The
l="blue")
isWhite = False
else:
w.itemconfig(rect, fill="white")
isWhite = True
w.bind("", change)
root.mainloop()
The problem occurs when clicking on the white square. The following error
appears:
"if isWhite:
UnboundL
> w.bind("", change)
>
> root.mainloop()
>
>
> The problem occurs when clicking on the white square. The following error
> appears: "if isWhite:
> UnboundLocalError: local variable 'isWhite' referenced before assignment"
>
> How
Just before anyone says, the reason I bind to the Canvas instead of binding
directly to the rectangle is because I plan to add more squares in the future.
Cheers.
--
http://mail.python.org/mailman/listinfo/python-list
False
else:
w.itemconfig(rect, fill="white")
isWhite = True
w.bind("", change)
root.mainloop()
The problem occurs when clicking on the white square. The following error
appears:
"if isWhite:
UnboundLocalError
Le 08/06/2010 10:03, ch1zra a écrit :
import os, time, re, pyodbc, Image, sys
from datetime import datetime, date, time
from reportlab.lib.pagesizes import A4
from reportlab.lib.units import cm
from reportlab.pdfgen import canvas
from reportlab.pdfbase import pdfmetrics
from reportlab.pdfbase.ttf
ch1zra a écrit :
On Jun 8, 10:59 am, Bryan wrote:
Python doesn't have one global namespace. Each module (file) has its
own namespace, which is a Python dict, and 'global' means defined in
the containing module's dict. Put the import:
from reportlab.pdfgen import canvas
in the mkTable.py fil
of this expression
> > is completely undefined, resulting in the error you're getting.
>
> The above would produce a NameError, not an UnboundLocalError:
Ah, yes. The OP's code produces a NameError.
[...]
> To get the latter you'd have to omit the global declaration.
Not h
t; canvas = canvas.Canvas(fname, pagesize=A4)
>>> > ... and so on
>>>
>>> > this gives me following traceback:
>>>
>>> > Traceback (most recent call last):
>>> > File "C:\py\pdf_test.py", line 36, in
>>> > mkTable
def mkTable():
> > global canvas
> > canvas = canvas.Canvas(fname, pagesize=A4)
> > ... and so on
>
> > this gives me following traceback:
>
> > Traceback (most recent call last):
> > File "C:\py\pdf_test.py", line 36, in
> > mkTa
t; this gives me following traceback:
>>
>> > Traceback (most recent call last):
>> > File "C:\py\pdf_test.py", line 36, in
>> > mkTable.mkTable()
>> > File "C:\py\mkTable.py", line 38, in mkTable
>> > canvas = canva
y\pdf_test.py", line 36, in
> > mkTable.mkTable()
> > File "C:\py\mkTable.py", line 38, in mkTable
> > canvas = canvas.Canvas("K_lista.pdf", pagesize=A4)
> > UnboundLocalError: local variable 'canvas' referenced before
> &g
o on
>
> this gives me following traceback:
>
> Traceback (most recent call last):
> File "C:\py\pdf_test.py", line 36, in
> mkTable.mkTable()
> File "C:\py\mkTable.py", line 38, in mkTable
> canvas = canvas.Canvas("K_lista.pdf", pa
ze=A4)
> ... and so on
>
> this gives me following traceback:
>
> Traceback (most recent call last):
> File "C:\py\pdf_test.py", line 36, in
> mkTable.mkTable()
> File "C:\py\mkTable.py", line 38, in mkTable
> canvas = canvas.Canvas("K_
st.py", line 36, in
mkTable.mkTable()
File "C:\py\mkTable.py", line 38, in mkTable
canvas = canvas.Canvas("K_lista.pdf", pagesize=A4)
UnboundLocalError: local variable 'canvas' referenced before
assignment
i haven't posted entire code, because those li
Gabriel Rossetti wrote:
Dave Angel wrote:
Gabriel Rossetti wrote:
Hello
everyone,
I get this error on python 2.6.1 on mac os x 10.6 :
UnboundLocalError: local variable '_[1]' referenced before assignment
here's the code that raises this:
params = [ self.__formatData(param
Gabriel Rossetti wrote:
Gabriel Rossetti wrote:
I get this error on python 2.6.1 on mac os x 10.6 :
UnboundLocalError: local variable '_[1]' referenced before assignment
here's the code that raises this:
params = [ self.__formatData(paramProcFunc, query, p) for p in params
Richard Thomas writes:
> That isn't an error that should occur, not least because _[1] isn't a
> valid name. Can you post a full traceback?
The name _[n] is used internally when compiling list comprehensions.
The name is chosen precisely because it is not an (otherwise) valid
identifier. For ex
Dave Angel wrote:
Gabriel Rossetti wrote:
Hello
everyone,
I get this error on python 2.6.1 on mac os x 10.6 :
UnboundLocalError: local variable '_[1]' referenced before assignment
here's the code that raises this:
params = [ self.__formatData(paramProcFunc, query, p)
Richard Thomas a écrit :
On Dec 9, 10:17 am, Gabriel Rossetti
wrote:
UnboundLocalError: local variable '_[1]' referenced before assignment
That isn't an error that should occur, not least because _[1] isn't a
valid name
It's an internal identifier used in l
Gabriel Rossetti wrote:
Hello
everyone,
I get this error on python 2.6.1 on mac os x 10.6 :
UnboundLocalError: local variable '_[1]' referenced before assignment
here's the code that raises this:
params = [ self.__formatData(paramProcFunc, query, p) for p in params ]
what
On Dec 9, 10:17 am, Gabriel Rossetti
wrote:
> Hello everyone,
>
> I get this error on python 2.6.1 on mac os x 10.6 :
>
> UnboundLocalError: local variable '_[1]' referenced before assignment
>
> here's the code that raises this:
>
> params = [ self.__fo
Hello everyone,
I get this error on python 2.6.1 on mac os x 10.6 :
UnboundLocalError: local variable '_[1]' referenced before assignment
here's the code that raises this:
params = [ self.__formatData(paramProcFunc, query, p) for p in params ]
what I don't get is that i
Duncan Booth wrote:
/ class CallableOnlyOnce(object):
/def __init__(self, func):
self.func = func
def __call__(self):
f = self.func
if f:
self.func = None
return f()
/ def callonce(func):
/ return CallableOnlyOnce(func)
/ @callonce
/
Rich Healey wrote:
> It seems that my problem was that I can't assign a new function to the
> name func within the callonce() function. I can however interact with
> the func object (in this case storing information about whether or not
> I'd called it in it's __RECALL item.
>
> Is there a clean
print "T2 called"
> t2()
>
> Gives me:
>
> C:\tmp\callonce>callonce.py
> Traceback (most recent call last):
> File "C:\tmp\callonce\callonce.py", line 27, in
> t2()
> File "C:\tmp\callonce\callonce.py", line 12, in __
> r
On Tue, Sep 29, 2009 at 9:41 PM, Chris Rebert wrote:
> On Tue, Sep 29, 2009 at 9:15 PM, Rich Healey wrote:
>> However:
>>
>> def callonce(func):
>> def nullmethod(): pass
>> def __():
>> return func()
>> func = nullmethod
Additionally, to rebind a variable in an outer nested
On Tue, Sep 29, 2009 at 9:15 PM, Rich Healey wrote:
> However:
>
> def callonce(func):
> def nullmethod(): pass
> def __():
> return func()
> func = nullmethod
When Python sees this assignment to func as it compiles the __()
method, it marks func as a local variable and will n
nce
> def t2():
> print "T2 called"
> t2()
>
> Gives me:
>
> C:\tmp\callonce>callonce.py
> Traceback (most recent call last):
> File "C:\tmp\callonce\callonce.py", line 27, in
> t2()
> File "C:\tmp\callonce\callonce.py", li
t2()
File "C:\tmp\callonce\callonce.py", line 12, in __
return func()
UnboundLocalError: local variable 'func' referenced before assignment
Any ideas on why? This looks like a bug to me, but I'm quite new to
this style of programming so it may be some nuance I'm
illiers
wrote:
From: Bruno Desthuilliers
Subject: Re: UnboundLocalError - (code is short & simple)
To: python-list@python.org
Date: Monday, September 28, 2009, 8:24 AM
Chris Rebert a écrit :
> On Sun, Sep 27, 2009 at 8:5
rtin
--- On Mon, 9/28/09, Chris Kaynor wrote:
From: Chris Kaynor
Subject: Re: UnboundLocalError - (code is short & simple)
To: python-list@python.org
Date: Monday, September 28, 2009, 4:00 PM
On Sun, Sep 27, 2009 at 10:39 PM, New User wrote:
Hi Chris,
Thank you for the reply and info!
on the python list - I just forgot to remove you
from it (I used G-Mail's reply all). In general, unless the reply is
off-topic or personal, it should be replied to on-list. This allows more
people to both see the answer and to help further explain the answer.
>
> --- On *Mon, 9/28/09, Chris Ka
File "", line 1, in
> toss_winner()
> File "C:/Python26/toss_winner.py", line 7, in toss_winner
> coin_toss = coin_toss()
> UnboundLocalError: local variable 'coin_toss' referenced before
> assignment
>
> Question #1:
>
> After reviewi
_winner
coin_toss = coin_toss()
UnboundLocalError: local variable 'coin_toss' referenced before
assignment
---
# toss_winner.py
from coin_toss import coin_toss
def toss_winner():
coin_toss = coin_toss()
When Python sees t
toss_winner
> coin_toss = coin_toss()
> UnboundLocalError: local variable 'coin_toss' referenced before
> assignment
>
> ---
>
> # toss_winner.py
>
> from coin_toss import coin_toss
>
> def toss_winner
ot;Python Programming: An Intro to Computer Science" by Zelle.
>
> Thanks!
>
> ---
>
> Traceback (most recent call last):
> File "", line 1, in
>toss_winner()
> File "C:/Pytho
file is listed below.)
Problem:
I am getting an error when I run "toss_winner.py."
Error Message:
Traceback (most recent call last):
File "", line 1, in
toss_winner()
File "C:/Python26/toss_winner.py", line 7, in toss_winner
coin_toss = coin_toss()
UnboundLocalE
n. I'm currently self-studying
"Python Programming: An Intro to Computer Science" by Zelle.
Thanks!
---
Traceback (most recent call last):
File "", line 1, in
toss_winner()
File "C:/Python26/t
111
abc is local to test(). print(abc) looks for a local abc, can't find one,
and so searches the higher scope, and finds it there.
> 2.
> def test():
> abc="111"
> def m1():
> print(abc)
> abc+="222"
&g
anywhere in the function body, it's
local". This is done by static analysis when the code is compiled.
2.
def test():
abc="111"
def m1():
print(abc)
abc+="222"
m1()
test()
Output:
print(abc)
UnboundLocalError
ut: 111
>
> 2.
> def test():
>abc="111"
>def m1():
You need a 'nonlocal' declaration here (requires Python 3.0 I think).
See PEP 3104 for more info -- http://www.python.org/dev/peps/pep-3104/
>print(abc)
>
abc+="222"
m1()
test()
Output:
print(abc)
UnboundLocalError: local variable 'abc' referenced before assignment
3.
def test2():
abc=[111]
def m1():
print(abc)
abc.append(222)
m1()
print(abc)
test2()
Andreas Tawn wrote:
Terry Reedy wrote:
For loop variables continue after the loop exits. This is
intentional.
I never knew that and I can't find reference to it in the docs. Can you
help me with the reasons for it?
1. Python's reluctance to multiply scopes without necessity (as other
re
Andreas Tawn wrote:
I don't have experience of too many other languages, but in C++ (and I
guess C)...
That's invalid C (you cannot declare variables in the "for" statement
itself, at least not in C89). And back in the old days, some C++
compilers did in fact leak declarations from "for" lo
> Andreas Tawn wrote:
> > Terry Reedy wrote:
> >> Wrong.
> > Thank you.
> >
> >> For loop variables continue after the loop exits. This is
> >> intentional.
> > I never knew that and I can't find reference to it in the docs.
>
> Interesting starting point. It never occurred to me
> that they
Andreas Tawn wrote:
Terry Reedy wrote:
Wrong.
Thank you.
For loop variables continue after the loop exits. This is
intentional.
I never knew that and I can't find reference to it in the docs.
Interesting starting point. It never occurred to me
that they might not. (So I didn't look for an
Andreas Tawn wrote:
I never knew that and I can't find reference to it in the docs.
the for-in loop does ordinary assignments in the current scope:
http://docs.python.org/ref/for.html
"Each item in turn is assigned to the target list using the
standard rules for assignments, and
Terry Reedy wrote:
>Wrong.
Thank you.
>For loop variables continue after the loop exits. This is
>intentional.
I never knew that and I can't find reference to it in the docs. Can you
help me with the reasons for it?
Drea
--
http://mail.python.org/mailman/listinfo/python-list
Andreas Tawn wrote:
I think a better explanation is that in your original function, x only
existed while the for loop was running. As soon as execution hit the
break statement, x ceased to exist.
Wrong. For loop variables continue after the loop exits. This is
intentional. Mensanator gav
(most recent call last):
File "", line 1, in
[isPrime(y) for y in range(11)]
File "C:\Python25\Progs\blandat\myMath.py", line 9, in isPrime
if x == nbr:
UnboundLocalError: local variable 'x' referenced before assignment
map(isPrime, range(100))
Tracebac
> > break
> > > if x == nbr:
> > > return True
> > > else:
> > > return False
>
> > > >>> [isPrime(y) for y in range(11)]
>
> > > Traceback (most recent call last):
> > > F
; return False
>
> >>>>> [isPrime(y) for y in range(11)]
>
> >> Traceback (most recent call last):
> >> File "", line 1, in
> >> [isPrime(y) for y in range(11)]
> >> File "C:\Python25\Progs\blandat\myMath.py", lin
return False
>
> > >>> [isPrime(y) for y in range(11)]
>
> > Traceback (most recent call last):
> > File "", line 1, in
> > [isPrime(y) for y in range(11)]
> > File "C:\Python25\Progs\blandat\myMath.py", line 9, in isPrime
&
, in
> [isPrime(y) for y in range(11)]
> File "C:\Python25\Progs\blandat\myMath.py", line 9, in isPrime
> if x == nbr:
> UnboundLocalError: local variable 'x' referenced before assignment
>
> >>> map(isPrime, range(100))
>
> Traceback (mo
>> File "", line 1, in
>> [isPrime(y) for y in range(11)]
>> File "C:\Python25\Progs\blandat\myMath.py", line 9, in isPrime
>> if x == nbr:
>> UnboundLocalError: local variable 'x' referenced before assignment
>>
>
== nbr:
return True
else:
return False
[isPrime(y) for y in range(11)]
Traceback (most recent call last):
File "", line 1, in
[isPrime(y) for y in range(11)]
File "C:\Python25\Progs\blandat\myMath.py", line 9, in isPrime
if x == nbr:
Unbo
True
else:
return False
>>> [isPrime(y) for y in range(11)]
Traceback (most recent call last):
File "", line 1, in
[isPrime(y) for y in range(11)]
File "C:\Python25\Progs\blandat\myMath.py", line 9, in isPrime
if x == nbr:
UnboundLocalError:
IG_TYPE = 0
ORIG_MSG = ""
def my_func2(IsEnabled):
you need
global ORIG_TYPE,ORIG_MSG
if IsEnabled:
ORIG_TYPE,ORIG_MSG = get_current()
because this otherwise marks them as local.
[snip]
When I run it,it errors out at :
set_status(ORIG_TYPE,ORIG_MSG)
g
op.run()
When I run it,it errors out at :
set_status(ORIG_TYPE,ORIG_MSG)
giving the error "UnboundLocalError: local variable 'ORIG_TYPE' referenced
before assignment" .This happens
Aren't ORIG_TYPE and ORIG_MSG global variables? Where am I going
wrong?
recent call last):
> > File "C:\UDR2\UDRxmlGateway.py", line 388, in
> > ParseAll()
> > File "C:\UDR2\UDRxmlGateway.py", line 371, in ParseAll
> > if (PfFlag == 1):
> > UnboundLocalError: local variable 'PfFlag' reference
lGateway.py", line 388, in
> ParseAll()
> File "C:\UDR2\UDRxmlGateway.py", line 371, in ParseAll
> if (PfFlag == 1):
> UnboundLocalError: local variable 'PfFlag' referenced before assignment
>
> PfFlag gets assigned in a for loop in
if (PfFlag == 1):
UnboundLocalError: local variable 'PfFlag' referenced before assignment
PfFlag gets assigned in a for loop in line 365
for i in range(PfFlagArrSize):
if (PfFlagArr[i] == 1):
---> PfFlag = int(1)
break
else
> def processLogEntry(entry):
# ADD THIS TO YOUR CODE
global cmterID_
>
>revision = int(entry.getRevision())
>commiter = str(entry.getAuthor())
>datetime = getTimeStamp(entry.getDate())
>message = str(entry.getMessage())
>
>Commiter_[0] = cmterID_ //HERE's THE PROBLEM
The r
> def processLogEntry(entry):
# ADD THIS TO YOUR CODE
global cmterID_
>
>revision = int(entry.getRevision())
>commiter = str(entry.getAuthor())
>datetime = getTimeStamp(entry.getDate())
>message = str(entry.getMessage())
>
>Commiter_[0] = cmterID_ //HERE's THE PROBLEM
The r
some vars outside the functions (global
ones), but when i use them inside the functions, i get an
"UnboundLocalError" error.
Here's the interesting part of the code:
==
#imports
1 - 100 of 149 matches
Mail list logo