error with setParseAction

  • Anonymous - 2012-02-05

    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.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\", 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:
    return func(*args)
    except TypeError:
    if limit:
    limit -= 1
    return wrapper

  • Paul McGuire

    Paul McGuire - 2012-06-16

    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 - this should install the correct version of pyparsing for you. (You can manually select the file and just copy it to your site-packages directory also).


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

Sign up for the SourceForge newsletter:

No, thanks