best way to read a configuration file

Paul McGuire bogus at
Tue Mar 9 09:31:47 CET 2004

"cmkl" <cmkleffner at> wrote in message
news:3b091a1c.0403080738.12a457bd at
> Paul,
> do you have a jython compatible pyparsing version?.
> I tried to modifiy pyparsing for jython-2.2a0 without
> success (jython still doesnt support newstyle classes)
> Regards
> Carl
> "Paul McGuire" <bogus at> wrote in message
news:<1qj1c.29893$qo.16145 at>...
> >
> > pyparsing also comes with an expression parser and evaluator in its
> > examples.  With some creative merging of the two, I think you could in
> > fairly short order have a config parser that would handle your Na = K+2
> > res_file = "$result_dir..." config values.
> >
> > The pyparsing home page is at
> >
> > HTH,
> > -- Paul
Carl -

I wrote a converter (using pyparsing) to replace all of the super() calls to
explicit superclass calls, and remove the inheritance from object.  Now I
get strange TypeError exceptions like this:

Traceback (most recent call last):
  File "", line 1276, in ?
    test( "SELECT * from XYZZY, ABC" )
  File "", line 1250, in test
    tokens = simpleSQL.parseString( teststring )
  File "", line 313, in parseString
    loc, tokens = self.parse( instring.expandtabs(), 0 )
  File "", line 278, in parse
    loc,tokens = self.parseImpl( instring, loc, doActions )
  File "", line 758, in parseImpl
    resultlist += exprtokens
TypeError: 'str' object is not callable

So this is mystifying to me - in this particular case, resultlist and
exprtokens are both ParseResults objects, and there is a defined __iadd__
method - is operator overloading also part of newstyle classes?  Also, I
suspect we would need to remove the scanString() method, since this uses
generators, and I would guess Jython doesn't support those, either.

Overall, I am not optimistic at the chances of getting pyparsing working
with Jython... :(

-- Paul

More information about the Python-list mailing list