#52 "symbols" used before assignment

closed-wont-fix
nobody
None
5
2012-06-16
2012-03-28
Daniel-s
No

The following code produces an error:

def parse():
keyword = "*" + Word(alphas)

# These describe the way data is put into CSV lines
# The single value
dataElement = OneOrMore(Word(alphas + nums + "-" + "."))
# A given line of several dataElements
dataLine = OneOrMore(dataElement + Suppress(",")) + dataElement

#inputField = keyword + OneOrMore(dataLine)
inputField = keyword + OneOrMore(Group(oneOf(dataLine)))

parse()

File "c:\python26\lib\site-packages\pyparsing-1.5.6-py2.6-win32.egg\pyparsing.py", line 3256, in oneOf
while i < len(symbols)-1:
UnboundLocalError: local variable 'symbols' referenced before assignment

There are a whole bunch of if ... elif statements just above in which symbols is supposed to be created for the first time. Something must be getting skipped.

Discussion

  • Paul McGuire

    Paul McGuire - 2012-06-16
    • status: open --> closed-wont-fix
     
  • Paul McGuire

    Paul McGuire - 2012-06-16

    oneOf takes a string or list of strings, not a pyparsing expression.

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks