#1 pyparsing 1.2 Problmes with Hello Wolrd example ...

v1.0 (example)
closed
nobody
8
2004-06-25
2004-06-24
No

hi,
I installed the pypasring package :

F:\temp\pyparsing-1.2>python setup.py install
running install
running build
running build_py
creating build
creating build\lib
copying pyparsing.py -> build\lib
running install_lib
copying build\lib\pyparsing.py ->
C:\Python22\Lib\site-packages
byte-compiling
C:\Python22\Lib\site-packages\pyparsing.py to pyparsing.pyc

After this is tried the example Hello world :

>>> from pyparsing import Word, alphas
>>> greet = Word( alphas ) + "," + Word( alphas ) + "!"
>>> greeting = greet.parseString( "Hello, World!" )
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "pyparsing.py", line 480, in parseString
loc, tokens = self.parse( instring.expandtabs(), 0 )
File "pyparsing.py", line 430, in parse
loc,tokens = self.parseImpl( instring, loc, doActions )
File "pyparsing.py", line 1104, in parseImpl
loc, resultlist = self.exprs[0].parse( instring,
loc, doActions )
File "pyparsing.py", line 438, in parse
retTokens = ParseResults( tokens, self.resultsName,
asList=self.saveList )
File "pyparsing.py", line 119, in __new__
retobj.__doinit = True
AttributeError: 'ParseResults' object has no attribute
'_ParseResults__doinit'
>>>

Could you help me what the reason for the error stack is?
Regards
Carl r.

Discussion

    • priority: 5 --> 8
     
  • Paul McGuire
    Paul McGuire
    2004-06-25

    Logged In: YES
    user_id=893320

    I suspect this is also due to Python 2.2 issues with __slots__
    or __new__ handling.

    I run this example under Python 2.3.2 with no errors.

    I'm afraid I'll have to document that this latest version of
    pyparsing requires Python 2.3 or higher.

    -- Paul

     
  • Logged In: YES
    user_id=385682

    i upgrade to Python 2.3 - no problem Paul :-)
    Carl

     
  • Logged In: NO

    Hi paul, it worked :

    Python 2.3.4 (#53, May 25 2004, 21:17:02) [MSC v.1200 32 bit
    (Intel)] on win32
    Type "help", "copyright", "credits" or "license" for more
    information.
    >>> from pyparsing import Word, alphas
    >>>
    >>> greet = Word( alphas ) + "," + Word( alphas ) + "!"
    >>> greeting = greet.parseString( "Hello, World!" )
    >>> print greeting
    ['Hello', ',', 'World', '!']
    >>>

     
  • Paul McGuire
    Paul McGuire
    2004-06-25

    Logged In: YES
    user_id=893320

    I will add the dependency on Python 2.3.2 or greater to the
    pyparsing documentation.

    Thanks for keeping me honest!!!

    -- Paul

     
  • Paul McGuire
    Paul McGuire
    2004-06-25

    • status: open --> closed