Recent Changes

Monday, August 21

  1. user_add ckot71 ckot71 joined pyparsing
    6:36 am

Friday, August 18

  1. msg schemaSQL.parseFile(f) fails if parseAll=True attemted message posted schemaSQL.parseFile(f) fails if parseAll=True attemted Thanks for your help again!!! Haven't yet mastered virtualenv (I installed virtualenvwrapper-win …
    schemaSQL.parseFile(f) fails if parseAll=True attemted
    Thanks for your help again!!!
    Haven't yet mastered virtualenv (I installed virtualenvwrapper-win on windows), but tracked down and deleted all the pyparsing.pyc-s windows could find, and checked the version in every pyparsing.py source windows could find.
    To my great embarrassment the ONLY 1.4.11 was the one I downloaded from somewhere during internet search and put it right next to my source in the eclipse workspace.
    The others ranged from 2.0.1.10 - 2.2.0 (I recently installed with pip).
    After clearing that and restarting eclips the version is 2.2.0 (Yayyyy!)
    No if only I could fix the tcl/tk so mathplotlip could work :)
    10:42 am

Thursday, August 17

  1. msg Odd .copy() behaviour message posted Odd .copy() behaviour My first thought is that this is actually a bug in copy(). I'll look at this in more detail this we…
    Odd .copy() behaviour
    My first thought is that this is actually a bug in copy(). I'll look at this in more detail this weekend. I'll also take a look at what you have described and see if there is a reasonable workaround or alternative.
    9:28 pm
  2. msg schemaSQL.parseFile(f) fails if parseAll=True attemted message posted schemaSQL.parseFile(f) fails if parseAll=True attemted I've started sorting out these kinds of packaging issues using virtualenv, which allows you a lot m…
    schemaSQL.parseFile(f) fails if parseAll=True attemted
    I've started sorting out these kinds of packaging issues using virtualenv, which allows you a lot more flexibility to try installing/removing packages without messing up your system environment. If you are absolutely desperate, pyparsing's code is just a single .py file, so you can extract that and put it explicitly in your PYTHONPATH wherever you choose - but do this only as a last resort, or as a temporary workaround until you get your overall packaging bits resolved.
    9:20 pm
  3. msg Odd .copy() behaviour message posted Odd .copy() behaviour Ok – with a bit of poking around I understodd how this behaviour comes about: the copy() does a dee…
    Odd .copy() behaviour
    Ok – with a bit of poking around I understodd how this behaviour comes about: the copy() does a deep copy or the dependent expressions. The .addParseAction in enable_tree then hits a "dead", unused ParserElement.

    Now, I'd really love to be able to attach actions after the fact. I'd still like to use .setResultsName (which does an implicit copy). I *think* what I want is shallow copies of self.exprs; current pyparsing does an explicit copy since 1.5.3 (or somesuch) around line 3324:

            ret.exprs = [e.copy() for e in self.exprs]

    Does anyone remember what would break if I restored the previous behaviour, which, I think, essentially is equivalent to

            ret.exprs = self.exprs[:]

    (depending on copy.copy() semantics, I guess).
    5:10 am

Wednesday, August 16

  1. msg Odd .copy() behaviour message posted Odd .copy() behaviour I've finally made the jump from 1.5.2 or so to 2.1.10, and what kept me from upgrading back then b…
    Odd .copy() behaviour
    I've finally made the jump from 1.5.2 or so to 2.1.10, and what kept me
    from upgrading back then bites me again: .copy() changes the behaviour
    of ParserElements since 1.5.2:

    Here's an example:

    import pprint
    from pyparsing import Word, ZeroOrMore, alphas
     
    def get_grammar():
        vanishing = Word(alphas)
        item = "foo" | vanishing
        item_seq = item + ZeroOrMore( item )
        return locals()
     
    def enable_tree(syms):
        for name, ob in syms.iteritems():
            ob.setParseAction(lambda s, p, t, name=name: (name,)+tuple(t))
     
    if __name__=="__main__":
        g = get_grammar()
        enable_tree(g)
        pprint.pprint(g["item_seq"].parseString("foo bar")[0])

    If you ignore the plumbing, it's a trivial sequence grammar. The stuff
    is arranged to spit out a representation of the parse tree, and if you
    try it, you'll see it's printing the expected

    ('item_seq', ('item', 'foo'), ('item', ('vanishing', 'bar')))

    However, if you now change the grammar to:

    def get_grammar():
        vanishing = Word(alphas)
        item = "foo" | vanishing
        item = item.copy()       # <--- inserting a call to copy
        item_seq = item + ZeroOrMore( item )
        return locals()

    pyparsing doesn't "see" the "vanishing" nonterminal any more, and the
    output is:

    ('item_seq', ('item', 'foo'), ('item', 'bar'))

    In more complex grammars, you'll see that only the level below the
    copied (or, more dramatically, setResultsName-d) element is swallowed --
    rules deeper down are again correctly represented.

    Is this expected behaviour? I'm asking because apparently no one got
    hit by this in the past eight years apart from me, so somehow I suspect
    I'm being stupid. Am I?
    8:12 am

Monday, August 14

  1. msg schemaSQL.parseFile(f) fails if parseAll=True attemted message posted schemaSQL.parseFile(f) fails if parseAll=True attemted Sorry for the n00b question, but how can I rectify this? C:\Python27\Lib\site-packages\pyparsing…
    schemaSQL.parseFile(f) fails if parseAll=True attemted
    Sorry for the n00b question, but how can I rectify this?

    C:\Python27\Lib\site-packages\pyparsing.py has
    def parseFile( self, file_or_filename, parseAll=False ):

    And the C:\Python27\Lib\site-packages\pyparsing-2.2.0-py2.7.egg-info folder has some text files, but didn't find traces of the earlier version.
    Any "tools of the trade" advice?
    Would uninstalling the whole python and installing -say- activepython distro would help?
    7:46 am

Sunday, August 13

  1. msg schemaSQL.parseFile(f) fails if parseAll=True attemted message posted schemaSQL.parseFile(f) fails if parseAll=True attemted 1.4.11 Thank you, you are right as always :)
    schemaSQL.parseFile(f) fails if parseAll=True attemted
    1.4.11
    Thank you, you are right as always :)
    8:14 pm
  2. msg schemaSQL.parseFile(f) fails if parseAll=True attemted message posted schemaSQL.parseFile(f) fails if parseAll=True attemted Hm, matplotlib used to bundle pyparsing as part of its mathtext module, so you may be having confli…
    schemaSQL.parseFile(f) fails if parseAll=True attemted
    Hm, matplotlib used to bundle pyparsing as part of its mathtext module, so you may be having conflicts there. In your code, add:
    import pyparsing; print pyparsing.__version__

    If it turns out that you are having conflicts with matplotlib's pyparsing, then be sure to import pyparsing in your module before importing matplotlib. In this way, the latest pyparsing will get imported first, and the import in matplotlib will be a no-op. I *think* matplotlib will work okay with an updated pyparsing, but if you don't use mathtext, then it won't really matter.
    7:52 pm
  3. msg schemaSQL.parseFile(f) fails if parseAll=True attemted message posted schemaSQL.parseFile(f) fails if parseAll=True attemted >python -m pip list says: ... pyparsing (2.2.0) ... C:\Users\flazar>python -V Python…
    schemaSQL.parseFile(f) fails if parseAll=True attemted
    >python -m pip list says:
    ...
    pyparsing (2.2.0)
    ...

    C:\Users\flazar>python -V
    Python 2.7
    I was trying to get some plots with numpy and mathplotlib, and I have some unsolved mysteries with the windows 64bit python and some win32 libraries, so I'm not 100% sure the plumbing is flawless.
    7:41 pm

More