hello - i'm getting an error executing parseString when the following seemingly basic ParseAction is added - when there's no ParseAction set it parses without any issue. Any insight? I'm using the latest pyparsing-1.5.6 and Python 3.2
File "C:\Python32\lib\site-packages\pyparsing.py", line 689, in wrapper
return func(*args) UnboundLocalError: local variable 'limit' referenced before assignment
This code is from the version of pyparsing that is compatible with Python 2.x. Please get one of the Python 3.x compatible installation files, or download the source version and use setup.py - this should install the correct version of pyparsing for you. (You can manually select the pyparsing_py3.py file and just copy it to your site-packages directory also).
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
hello - i'm getting an error executing parseString when the following seemingly basic ParseAction is added - when there's no ParseAction set it parses without any issue. Any insight? I'm using the latest pyparsing-1.5.6 and Python 3.2
Series_Code=OneOrMore(Word(alphanums+"-"))("Series_Code")
Series_Code.setParseAction( lambda tokens : "".join(tokens))
test = "Series_Code: Series 1-1|"
topIDs = Suppress("Series_Code:") + Series_Code + Suppress("|")
parsed = (topIDs).parseString(test)
File "C:\Python32\lib\site-packages\pyparsing.py", line 689, in wrapper
return func(*args)
UnboundLocalError: local variable 'limit' referenced before assignment
this is the code referenced by the error
def _trim_arity(func, maxargs=2):
limit = maxargs
def wrapper(*args):
#~ nonlocal limit
while 1:
try:
return func(*args)
except TypeError:
if limit:
limit -= 1
continue
raise
return wrapper
This code is from the version of pyparsing that is compatible with Python 2.x. Please get one of the Python 3.x compatible installation files, or download the source version and use setup.py - this should install the correct version of pyparsing for you. (You can manually select the pyparsing_py3.py file and just copy it to your site-packages directory also).