Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > de.comp.lang.python > #5768

Re: local variable referenced before assignment?

From Ulli Horlacher <framstag@rus.uni-stuttgart.de>
Newsgroups de.comp.lang.python
Subject Re: local variable referenced before assignment?
Date 2021-11-17 15:33 +0000
Organization University of Stuttgart, FRG
Message-ID <sn37cr$gpf$2@news2.informatik.uni-stuttgart.de> (permalink)
References <sn3688$gpf$1@news2.informatik.uni-stuttgart.de>

Show all headers | View raw


Ulli Horlacher <framstag@rus.uni-stuttgart.de> wrote:
> Ich bekomme diesen Fehler und verstehe ihn nicht:
> 
>     config()
>   File "./fextasy.py", line 496, in config
>     sg.I(server,key='server',tooltip='F*EX server',size=80)],
> UnboundLocalError: local variable 'server' referenced before assignment
> 
> 
> def config():
>   read_config()
> 
>   col = [
>     [sg.I(server,key='server',tooltip='F*EX server',size=80)],

Habs... :-}

Weiter unten im Code hatte ich noch ein ueberfluessiges 
server = ...
stehen. 

Was ich daraus gelernt habe: 
Der Python Parser schaut sich das zur compile-time an, nicht zur Laufzeit. 


-- 
Ullrich Horlacher              Server und Virtualisierung
Rechenzentrum TIK         
Universitaet Stuttgart         E-Mail: horlacher@tik.uni-stuttgart.de
Allmandring 30a                Tel:    ++49-711-68565868
70569 Stuttgart (Germany)      WWW:    http://www.tik.uni-stuttgart.de/

Back to de.comp.lang.python | Previous | NextPrevious in thread | Find similar


Thread

local variable referenced before assignment? Ulli Horlacher <framstag@rus.uni-stuttgart.de> - 2021-11-17 15:14 +0000
  Re: local variable referenced before assignment? Ulli Horlacher <framstag@rus.uni-stuttgart.de> - 2021-11-17 15:33 +0000

csiph-web