Forums

trouble importing flask ext

OK, so getting used to setting up a webapp for testing. I installed the Markdown flask extension. From a python2.7 console, it shows up on my path as the second entry:

['', '/home/chadblack/.local/lib/python2.7/site-packages/Flask_Bootstrap-2.2.1_1-py2.7.egg', '/home/chadblack/.local/lib/python2.7/site-packages/Flask_Markdown-0.3-py2.7.egg', '/usr/local/lib/python2.7/site-packages/distribute-0.6.32-py2.7.egg', '/usr/local/lib/python2.7/site-packages/pip-1.2.1-py2.7.egg', '/usr/local/lib/python2.7/site-packages/pyzmq-2.2.0-py2.7-linux-x86_64.egg ', '/usr/local/lib/python2.7/site-packages/pyhdf-0.8.3-py2.7-linux-x86_64.egg', '/usr/local/lib/python2.7/site-packages/texcaller-0-py2.7-linux-x86_64.egg', '/usr/local/lib/python2.7/site-packages/openopt-0.42-py2.7.egg', '/usr/local/lib/python2.7/site-packages/setproctitle-1.1.6-py2.7-linux-x86_64.egg', '/usr/local/lib/python2.7/site-packages/uWSGI-1.4.2-py2.7.egg', '/usr/local/lib/python27.zip', '/usr/local/lib/python2.7', '/usr/local/lib/python2.7/plat-linux2', '/usr/local/lib/python2.7/lib-tk', '/usr/local/lib/python2.7/lib-old', '/usr/local/lib/python2.7/lib-dynload', '/home/chadblack/.local/lib/python2.7/site-packages', '/usr/local/lib/python2.7/site-packages', '/usr/local/lib/python2.7/site-packages/Orange/orng', '/usr/local/lib/python2.7/site-packages/PIL']

I'm having no problems importing Bootstrap with from flask.ext.bootstrap import Bootstrap.

But, when I try the same thing with Markdown, from flask.ext.markdown import Markdown, I get an import error: ImportError: No module named flask.ext.markdown. This is in the console and my webapp error logs.

It looks like they get imported differently:

from flaskext.markdown import Markdown

vs

from flask.ext.bootstrap import Bootstrap

Note the missing dot in the markdown version. The docs are here

It's very strange. On my local machine, with the same versions of Flask (0.9) and Flask_Markdown (0.3) installed

from flask.ext.markdown import Markdown

works. Same on heroku.

I just reinstalled with pip and now it works.

Thanks for the help, glenn.