Where do you define fCONV_AUSRICHTG? It must be initialized or defined somewhere. Did you leave out a statement from the python 2 version?
Sent from my iPhone > On Nov 7, 2023, at 1:06 PM, Thomas Passin via Python-list > <python-list@python.org> wrote: > > On 11/7/2023 12:47 PM, Egon Frerich via Python-list wrote: >> I've no idea why this happens. In a module there are lists and definitions: >> Felder = [ >> # Name lg1 lg2 typ Ausrichtung Holen Prüfen Prüfvorg >> ["Jahr", 4, 5, "u", "", "right", "center"], >> ["Monat", 2, 5, "u", "", "right", "center"], >> ["Tag", 2, 3, "u", "", "right", "center"], >> ["Belegnr", 5, 7, "s", "", "right", "center"], >> ["Bank", 2, 4, "u", "", "center", "center"], >> ["Art", 2, 3, "u", "", "center", "center"], >> ["Aufg", 2, 4, "u", "", "center", "center"], >> ["Text", 25, 25, "s", "-", "left", "left"], >> ["Ergänzung", 12, 12, "s", "-", "left", "left"], >> ["Betrag", 13, 13, "s", "", "right", "right"], >> ["W", 1, 2, "s", "", "center", "center"], >> ["WBetrag", 7, 7, "s", "", "right", "right"], >> ["Kurs", 6, 6, "s", "", "right", "right"], >> ] >> "Reihenfolge in der Dimension 1" >> ( >> fJAHR, >> fMONAT, >> fTAG, >> fBELEGNR, >> fBANK, >> fART, >> fAUFGABE, >> fTEXT, >> fTEXTERG, >> fBETRAG, >> fWAEHRUNG, >> fBETRAGinWAEHRUNG, >> fUMRECHNUNGSKURS, >> ) = list(range(13)) >> "Reihenfolge in der Dimension 2" >> ( >> fNAME, >> fLG1, >> fLG2, >> fTYP, >> fCONV_AUSRICHTG, >> fENTRY_AUSRICHTG, >> fTEXT_AUSRICHTUNG, >> fHOLFUNKT, >> fPRUEFFUNKT, >> fPRUEF_ARG, >> ) = list(range(10)) >> Two lines with test statements follow and the statement which produces an >> error: >> print(Felder) >> print(fJAHR, fNAME, fTYP, fCONV_AUSRICHTG) >> akette = "%" + "%".join( >> ["%s%s%s " % (i[fCONV_AUSRICHTG], i[fLG2], i[fTYP]) for i in Felder]) >> The traceback shows: >> $ python3 testGeldspurGUI.py >> [['Jahr', 4, 5, 'u', '', 'right', 'center'], ['Monat', 2, 5, 'u', '', >> 'right', 'center'], ['Tag', 2, 3, 'u', '', 'right', 'center'], ['Belegnr', >> 5, 7, 's', '', 'right', 'center'], ['Bank', 2, 4, 'u', '', 'center', >> 'center'], ['Art', 2, 3, 'u', '', 'center', 'center'], ['Aufg', 2, 4, 'u', >> '', 'center', 'center'], ['Text', 25, 25, 's', '-', 'left', 'left'], >> ['Ergänzung', 12, 12, 's', '-', 'left', 'left'], ['Betrag', 13, 13, 's', '', >> 'right', 'right'], ['W', 1, 2, 's', '', 'center', 'center'], ['WBetrag', 7, >> 7, 's', '', 'right', 'right'], ['Kurs', 6, 6, 's', '', 'right', 'right']] >> 0 0 3 4 >> Traceback (most recent call last): >> File "/home/egon/Entw/Geldspur/geldspur/testGeldspurGUI.py", line 15, in >> <module> >> from tests.testU2 import testU2 >> File "/home/egon/Entw/Geldspur/geldspur/tests/testU2.py", line 9, in >> <module> >> from gui.GUI_Konfig import GUIcfg >> File "/home/egon/Entw/Geldspur/geldspur/gui/GUI_Konfig.py", line 11, in >> <module> >> class GUIcfg: >> File "/home/egon/Entw/Geldspur/geldspur/gui/GUI_Konfig.py", line 90, in >> GUIcfg >> ["%s%s%s " % (i[fCONV_AUSRICHTG], i[fLG2], i[fTYP]) for i in Felder]) >> File "/home/egon/Entw/Geldspur/geldspur/gui/GUI_Konfig.py", line 90, in >> <listcomp> >> ["%s%s%s " % (i[fCONV_AUSRICHTG], i[fLG2], i[fTYP]) for i in Felder]) >> NameError: name 'fCONV_AUSRICHTG' is not defined >> You see "Felder" and with "0 0 3 4" the correct value 4 for fCONV_AUSRICHTG. >> But there is the NameError. >> What does <listcomp> mean? Is there a change from python2 to python3? > > You are using a syntax that I don't understand, but "listcomp" means a list > comprehenson. > > -- > https://mail.python.org/mailman/listinfo/python-list -- https://mail.python.org/mailman/listinfo/python-list