[antlr-interest] Problem with python runtime example (stdin)

Benjamin Niemann pink at odahoda.de
Fri Jun 20 13:42:59 PDT 2008


Hi Cesar,

On Fri, Jun 20, 2008 at 9:43 PM, Cesar Otero <hfrequency at gmail.com> wrote:
> Greetings to everyone!
>
> I recently stumbled onto this wiki entry "Book Examples Modified for Python"
>
> http://www.antlr.org/wiki/pages/viewpage.action?pageId=4554829
>
> Generating the grammar files works just fine. But, when I go to
> execute the test.py I get the following error message:
>
> ####
>
> Traceback (most recent call last):
>  File "C:/grammars/test.py", line 8, in <module>
>    char_stream = antlr3.ANTLRInputStream(sys.stdin)
>  File "C:\Python25\lib\site-packages\antlr_python_runtime-3.0.1-py2.5.egg\antlr3\streams.py",
> line 534, in __init__
>    data = file.read()
> AttributeError: read
>
> ####

That is indeed very strange. Looks like your sys.stdin is not a file object?!?!
Can you post your test.py?

-Ben


More information about the antlr-interest mailing list