It's strange, I'm just trying to update a value in sqlite3 database using flask-sqlalchemy.
anime = Anime.query.get(2)
anime.finished=2
db.session.add(anime)
db.session.commit()
Everything is OK before commiting, then I got a "ImportError: No module named pycharm_re".
Yes, I'm using PyCharmCE IDE, but have nothing PyCharm base import. When I trying this in the Terminal, caused the same error.
At last, I found it may be about whoosh-alchemy, I've meet this error before when I have had 2 whoosh.whoosh_index(app, SomeClass) in models.py.
I'm using Python 2.7.3 in PyCharmCE, using 2.7.5 in Terminal. System is OS X 10.9.2. The whole error log:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/flask/app.py", line 1836, in __call__
return self.wsgi_app(environ, start_response)
File "/Library/Python/2.7/site-packages/flask/app.py", line 1820, in wsgi_app
response = self.make_response(self.handle_exception(e))
File "/Library/Python/2.7/site-packages/flask/app.py", line 1403, in handle_exception
reraise(exc_type, exc_value, tb)
File "/Library/Python/2.7/site-packages/flask/app.py", line 1817, in wsgi_app
response = self.full_dispatch_request()
File "/Library/Python/2.7/site-packages/flask/app.py", line 1477, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/Library/Python/2.7/site-packages/flask/app.py", line 1381, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/Library/Python/2.7/site-packages/flask/app.py", line 1475, in full_dispatch_request
rv = self.dispatch_request()
File "/Library/Python/2.7/site-packages/flask/app.py", line 1461, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/Users/windrunner/bangumi/bangumi/views.py", line 76, in edit_anime
db.session.commit()
File "/Library/Python/2.7/site-packages/sqlalchemy/orm/scoping.py", line 149, in do
return getattr(self.registry(), name)(*args, **kwargs)
File "/Library/Python/2.7/site-packages/sqlalchemy/orm/session.py", line 721, in commit
self.transaction.commit()
File "/Library/Python/2.7/site-packages/sqlalchemy/orm/session.py", line 361, in commit
self.session.dispatch.after_commit(self.session)
File "/Library/Python/2.7/site-packages/sqlalchemy/event.py", line 372, in __call__
fn(*args, **kw)
File "/Library/Python/2.7/site-packages/flask_sqlalchemy/__init__.py", line 170, in session_signal_after_commit
models_committed.send(session.app, changes=d.values())
File "/Library/Python/2.7/site-packages/blinker/base.py", line 267, in send
for receiver in self.receivers_for(sender)]
File "/Library/Python/2.7/site-packages/flask_whooshalchemy.py", line 242, in _after_flush
index = whoosh_index(app, values[0][1].__class__)
File "/Library/Python/2.7/site-packages/flask_whooshalchemy.py", line 168, in whoosh_index
_create_index(app, model))
File "/Library/Python/2.7/site-packages/flask_whooshalchemy.py", line 190, in _create_index
if whoosh.index.exists_in(wi):
File "/Library/Python/2.7/site-packages/whoosh/index.py", line 136, in exists_in
ix = open_dir(dirname, indexname=indexname)
File "/Library/Python/2.7/site-packages/whoosh/index.py", line 123, in open_dir
return FileIndex(storage, schema=schema, indexname=indexname)
File "/Library/Python/2.7/site-packages/whoosh/index.py", line 421, in __init__
TOC.read(self.storage, self.indexname, schema=self._schema)
File "/Library/Python/2.7/site-packages/whoosh/index.py", line 656, in read
schema = pickle.loads(stream.read_string())
ImportError: No module named pycharm_re