3

I tried to run Python/cminus example. From http://pypi.python.org/pypi/stringtemplate3/3.1, I installed stringtemplate3 for python with sudo python setup.py install.

When I run cminus.py that starts with this code.

import sys
import antlr3
import stringtemplate3

I got errors.

Traceback (most recent call last):
  File "cminus.py", line 3, in <module>
    import stringtemplate3
  File "/Library/Python/2.7/site-packages/stringtemplate3/__init__.py", line 14, in <module>
    from stringtemplate3.templates import *
  File "/Library/Python/2.7/site-packages/stringtemplate3/templates.py", line 35, in <module>
    import antlr
ImportError: No module named antlr

It looks like that stringtemplate3 uses antlr not antlr3.

How can I solve this issue?

2
  • Couldn't you just modify stringtemplate3 so it uses antlr3? Commented Jan 6, 2012 at 6:23
  • I could not reproduce this. When I install stringtemplate3, and use that particular build, I don't get a ImportError: No module named antler. Commented Jan 6, 2012 at 8:50

1 Answer 1

5

I got an answer from this page - Where to get Python ANTLR package to use StringTemplate?

  1. goto http://www.antlr2.org/download/antlr-2.7.7.tar.gz
  2. unzip it to go to lib/python directory
  3. run sudo python setup.py install.

I had to install antler from antlr2.7

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.