Python Forum
Variable reported as not set, though I"ve set it before...
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Variable reported as not set, though I"ve set it before...
#4
(Apr-18-2018, 07:44 PM)georgelza Wrote: if gotEFTConnection == False:
UnboundLocalError: local variable 'gotEFTConnection' referenced before assignment

You're trying to use a variable, before you ever set a value to it. Probably, you're trying to use a global variable, which is why the error isn't very helpful (globals aren't recommended). If you want to use a global, you need to let the function know that you've set it somewhere else before you try to use it. Something like:
def eftdashboard():
    global gotEFTConnection
    # then the rest of your function
Reply


Messages In This Thread
RE: Variable reported as not set, though I"ve set it before... - by nilamo - Apr-18-2018, 07:59 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020