mitsuhiko/flask-babel — Issue #19: Strange behavior in pip/virtualenv
Author: ralfonso
Created: 2012-01-29 20:07:02+00:00
State: open

I'm not sure if this is a Flask-Babel or Flask issue, but I've noticed something very strange about flaskext importing.

If I install a Flask ext through pip and install another as --editable, I can't import the editable version unless I also install Flask-Babel (non-editable) and import it first.

I've narrowed this down to the fact that Flask-Babel imports from the actual Babel module (from babel import dates, numbers, support, Locale).

Without the import from Babel, any attempts to import editable modules will fail. What makes this even more perplexing is that this behavior is not observed from within ipython, only through the vanilla Python shell or during the normal running of my application. Through ipython, all imports work perfectly regardless of which modules I have installed and where.

Sample session (flask-kvsession is installed --editable, flask-babel is installed normally)

```
Python 2.7.2 (v2.7.2:8527427914a2, Jun 11 2011, 15:22:34)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from flask.ext.kvsession import KVSession
Traceback (most recent call last):
File "", line 1, in
File "/Users/rroemmich/tmp/t/env/lib/python2.7/site-packages/flask/exthook.py", line 86, in load_module
raise ImportError('No module named %s' % fullname)
ImportError: No module named flask.ext.kvsession
>>> from flask.ext.babel import Babel
>>> from flask.ext.kvsession import KVSession
>>>
```