sh4nks / flask-plugins

This extension provides an easy way to create plugins for your flask application.
http://flask-plugins.readthedocs.org/en/latest/
Other
52 stars 21 forks source link

Error on example app #9

Closed yaghmr closed 9 years ago

yaghmr commented 10 years ago

I get this error trying to executing the example application:

Traceback (most recent call last):
  File "app.py", line 22, in <module>
    plugin_manager = PluginManager(app)
  File "/Library/Python/2.7/site-packages/flask_plugins/__init__.py", line 174, in __init__
    self.init_app(app, **kwargs)
  File "/Library/Python/2.7/site-packages/flask_plugins/__init__.py", line 192, in init_app
    self.setup_plugins()
  File "/Library/Python/2.7/site-packages/flask_plugins/__init__.py", line 276, in setup_plugins
    for plugin in itervalues(self.plugins):
  File "/Library/Python/2.7/site-packages/flask_plugins/__init__.py", line 206, in plugins
    self.load_plugins()
  File "/Library/Python/2.7/site-packages/flask_plugins/__init__.py", line 216, in load_plugins
    for plugin_name, plugin_package in iteritems(self.find_plugins()):
  File "/Library/Python/2.7/site-packages/flask_plugins/__init__.py", line 253, in find_plugins
    tmp = importlib.import_module(plugin)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
ImportError: No module named example.plugins.hello_world
sh4nks commented 10 years ago

Works for me without problems. Have you tried it to install it in an virtualenv?

yaghmr commented 10 years ago

Yes, same error in a venv.

abc2001x commented 10 years ago

run script in example parent folder @yaghmr

RobbieClarken commented 10 years ago

run script in example parent folder @yaghmr

Which script are you referring to @abc2001x?

I get the same error as @yaghmr with the following commands (running Python 2.7.8 on Mac OS X 10.9.5):

git clone git@github.com:sh4nks/flask-plugins.git
cd flask-plugins/example/
virtualenv .venv
. .venv/bin/activate
pip install flask flask-plugins
python app.py

Traceback (most recent call last):
  File "app.py", line 22, in <module>
    plugin_manager = PluginManager(app)
  File "/Users/robbie/Developer/flask-plugins/example/.venv/lib/python2.7/site-packages/flask_plugins/__init__.py", line 174, in __init__
    self.init_app(app, **kwargs)
  File "/Users/robbie/Developer/flask-plugins/example/.venv/lib/python2.7/site-packages/flask_plugins/__init__.py", line 192, in init_app
    self.setup_plugins()
  File "/Users/robbie/Developer/flask-plugins/example/.venv/lib/python2.7/site-packages/flask_plugins/__init__.py", line 276, in setup_plugins
    for plugin in itervalues(self.plugins):
  File "/Users/robbie/Developer/flask-plugins/example/.venv/lib/python2.7/site-packages/flask_plugins/__init__.py", line 206, in plugins
    self.load_plugins()
  File "/Users/robbie/Developer/flask-plugins/example/.venv/lib/python2.7/site-packages/flask_plugins/__init__.py", line 216, in load_plugins
    for plugin_name, plugin_package in iteritems(self.find_plugins()):
  File "/Users/robbie/Developer/flask-plugins/example/.venv/lib/python2.7/site-packages/flask_plugins/__init__.py", line 253, in find_plugins
    tmp = importlib.import_module(plugin)
  File "/usr/local/Cellar/python/2.7.8_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
ImportError: No module named example.plugins.hello_world
fredericmohr commented 9 years ago

Same problem here. Running the script (app.py) from the parent folder didn't help either. But I got it running by creating a link inside the folder that contained the app.py file

$ pwd
~/GIT/python-apps/flask-plugin-example/example
$ ln -s . example
$ ls -nh
total  56K
drwxr-xr-x 4.0K plugins/
drwxr-xr-x 4.0K templates/
-rw-r--r-- 2.2K app.py
-rw-r--r-- 3.4K app.pyc
lrwxrwxrwx 1    example -> ./
-rw-r--r-- 0    __init__.py
-rw-r--r-- 164  __init__.pyc
$ python app.py
sh4nks commented 9 years ago

Okay, I got it now - I have installed this extension in my virtualenv and thats why I can run the example app without problems.