Jinja2.5 Syntax error on import
Question: I am using Python 3.2.3. And I installed Jinja2.5 by downloading from this
page: `https://pypi.python.org/pypi/Jinja2/2.5.5`

Then I used the setup.py to install it. This seemed worked like a charm. When
I tested it by using this line:

    
    
    from jinja2 import Template
    

I got the following error:

    
    
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/usr/local/lib/python3.2/dist-packages/Jinja2-2.5.5-py3.2.egg/jinja2/__init__.py", line 37, in <module>
        from jinja2.environment import Environment, Template
      File "/usr/local/lib/python3.2/dist-packages/Jinja2-2.5.5-py3.2.egg/jinja2/environment.py", line 13, in <module>
        from jinja2 import nodes
      File "/usr/local/lib/python3.2/dist-packages/Jinja2-2.5.5-py3.2.egg/jinja2/nodes.py", line 18, in <module>
        from jinja2.utils import Markup, MethodType, FunctionType
      File "/usr/local/lib/python3.2/dist-packages/Jinja2-2.5.5-py3.2.egg/jinja2/utils.py", line 585, in <module>
        from markupsafe import Markup, escape, soft_unicode
      File "/usr/local/lib/python3.2/dist-packages/markupsafe/__init__.py", line 70
        def __new__(cls, base=u'', encoding=None, errors='strict'):
                                ^
    SyntaxError: invalid syntax
    

This is on my Raspberry pi with Raspbian installed. I don't know why this
error occures, because the docs say Jinja2.5 and Python 3.2 are compatible.

Can anyone help me out? Thanks in advance!


Answer: Try typing `python --version` if the reply does not say Python 3. something
then your default python is python 2 and so does not support `u''` for unicode
strings.

If this is the case you need to install `jinja2` by using `pip3 install
jinja2` and run your scripts with `python3 scriptname.py`.

Other than that see: [Syntax error in jinja 2
library](http://stackoverflow.com/questions/18252804/syntax-error-in-
jinja-2-library?rq=1) basically python 3.2 is no longer supported so the
choice is pick another library or upgrade python.

