Putting extension in flask.ext: the import loader in ext/__init__.py raises unnecessary error #608

Closed
phaikawl opened this Issue Oct 9, 2012 · 1 comment

2 participants

@phaikawl

I'm running my app on Google App Engine.
I put an extension (flask-lazyviews) in flask.ext and then import it, then an import error appears "No module named flask.ext.lazy.werkzeug".
Of course it's not the extension's fault, because it just "from werkzeug.xx import xx", nothing's wrong with it.
And if I disable the import hook in flask.ext.init.py, everything works, the import works, no problem whatsoever.
I read the code of the import hook (in exthook.py), apparently it's raising an exception because it cannot import the module from some paths.
I think it's not a valid behavior, how could it account for every possible path that the environment provides? It CANNOT! On Google App Engine there's a mysterious import path automatically added by some way (the application folder).
It should not raise an error.
note: the example in PEP 302 doesn't raise an error.

@mitsuhiko
The Pallets Projects member

You are not supposed to drop anything into that folder. It's a virtual folder to enable updates.

@mitsuhiko mitsuhiko closed this Oct 9, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment