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


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

Re: local variable referenced before assignment?

Path csiph.com!weretis.net!feeder8.news.weretis.net!news.datentrampelpfad.de!thinkmo.de!news.uni-stuttgart.de!.POSTED!not-for-mail
From Ulli Horlacher <framstag@rus.uni-stuttgart.de>
Newsgroups de.comp.lang.python
Subject Re: local variable referenced before assignment?
Date Wed, 17 Nov 2021 15:33:47 +0000 (UTC)
Organization University of Stuttgart, FRG
Lines 31
Message-ID <sn37cr$gpf$2@news2.informatik.uni-stuttgart.de> (permalink)
References <sn3688$gpf$1@news2.informatik.uni-stuttgart.de>
X-Trace news2.informatik.uni-stuttgart.de 1637163227 17199 129.69.1.129 (17 Nov 2021 15:33:47 GMT)
X-Complaints-To news@news.uni-stuttgart.de
NNTP-Posting-Date Wed, 17 Nov 2021 15:33:47 +0000 (UTC)
User-Agent tin/2.4.5-20200522 ("Millburn") (Linux/5.4.0-90-generic (x86_64))
Xref csiph.com de.comp.lang.python:5768

Show key headers only | 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 | Unroll thread


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