Install stringtemplate3 for python

1.5k views Asked by At

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?

1

There are 1 answers

0
prosseek On BEST ANSWER

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