python - pyramid_jinja2: ImportError: cannot import name Environment -
i'm going through tutorial pyramid framework , i'm stuck @ 1 teaches use of jinja2 templating engine.. seems when run test using nosetests, odd importerror stating name environment couldn't imported jinja2 module. funny thing is, when pserve site, works fine. seems error occur during test...i working off virtualenv using ubuntu 14.04.
any suggestions?
here's stack trace...
====================================================================== error: test_home (jinja2.tutorial.tests.tutorialfunctionaltests) ---------------------------------------------------------------------- traceback (most recent call last): file "/home/bk/pg/pyramid/quick_tutorial/jinja2/tutorial/tests.py", line 30, in setup app = main({}) file "/home/bk/pg/pyramid/quick_tutorial/jinja2/tutorial/__init__.py", line 5, in main config.include('pyramid_jinja2') file "/home/bk/pg/pyramid/venv/local/lib/python2.7/site-packages/pyramid/config/__init__.py", line 727, in include c = self.maybe_dotted(callable) file "/home/bk/pg/pyramid/venv/local/lib/python2.7/site-packages/pyramid/config/__init__.py", line 825, in maybe_dotted return self.name_resolver.maybe_resolve(dotted) file "/home/bk/pg/pyramid/venv/local/lib/python2.7/site-packages/pyramid/path.py", line 320, in maybe_resolve return self._resolve(dotted, package) file "/home/bk/pg/pyramid/venv/local/lib/python2.7/site-packages/pyramid/path.py", line 327, in _resolve return self._zope_dottedname_style(dotted, package) file "/home/bk/pg/pyramid/venv/local/lib/python2.7/site-packages/pyramid/path.py", line 376, in _zope_dottedname_style found = __import__(used) file "/home/bk/pg/pyramid/venv/local/lib/python2.7/site-packages/pyramid_jinja2-2.5-py2.7.egg/pyramid_jinja2/__init__.py", line 6, in <module> jinja2 import environment _jinja2environment importerror: cannot import name environment ----------------------------------------------------------------------
@michael merickel right. have conflict between jinja2 module , real one. mistake grows python2 import politics. can add first line of script magic sentence from __future__ import absolute_import. changes relative import absolute.
more information: pep 0328 -- imports: multi-line , absolute/relative
but solution doesn't if want execute script /home/bk/pg/pyramid/quick_tutorial/. because in situation 2 possible way resolve import jinja2.
Comments
Post a Comment