Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'LocalStack' object has no attribute '__ident_func__' error on launch #270

Open
robintw opened this issue Apr 27, 2022 · 2 comments
Open

Comments

@robintw
Copy link

robintw commented Apr 27, 2022

After installing sandman2 in a clean environment, I ran it as follows:

sandman2ctl 'sqlite+pysqlite:///chinook.db'

(using the chinook sample database from here).

I get the following error:

Traceback (most recent call last):
  File "/Users/robin/mambaforge/envs/sandman/bin/sandman2ctl", line 5, in <module>
    from sandman2.__main__ import main
  File "/Users/robin/mambaforge/envs/sandman/lib/python3.8/site-packages/sandman2/__init__.py", line 2, in <module>
    from sandman2.app import get_app, db, AutomapModel
  File "/Users/robin/mambaforge/envs/sandman/lib/python3.8/site-packages/sandman2/app.py", line 18, in <module>
    from sandman2.service import Service
  File "/Users/robin/mambaforge/envs/sandman/lib/python3.8/site-packages/sandman2/service.py", line 12, in <module>
    from sandman2.model import db
  File "/Users/robin/mambaforge/envs/sandman/lib/python3.8/site-packages/sandman2/model.py", line 13, in <module>
    db = SQLAlchemy()
  File "/Users/robin/mambaforge/envs/sandman/lib/python3.8/site-packages/flask_sqlalchemy/__init__.py", line 715, in __init__
    self.session = self.create_scoped_session(session_options)
  File "/Users/robin/mambaforge/envs/sandman/lib/python3.8/site-packages/flask_sqlalchemy/__init__.py", line 748, in create_scoped_session
    scopefunc = options.pop('scopefunc', _app_ctx_stack.__ident_func__)
AttributeError: 'LocalStack' object has no attribute '__ident_func__'

After some Googling, I found that it might be a version issue with the latest version of werkzeug and the pinned version of flask-sqlalchemy (which was 2.4.0). Upgrading to the latest flask-sqlalchemy (2.5.1 currently) seems to fix it.

Shall I submit a PR to update setup.py to use the latest flask-sqlalchemy, or might be there be more to this that I'm missing?

@EloWork
Copy link

EloWork commented Jan 25, 2023

Any updates here? I still see 2.4 in the code and I think I have the same issue. Only difference is for me it is a _FakeStack object missing that attribute.
AttributeError: '_FakeStack' object has no attribute '__ident_func__'

@ArchiLantern
Copy link

ArchiLantern commented Jun 6, 2023

Any updates here? I still see 2.4 in the code and I think I have the same issue. Only difference is for me it is a _FakeStack object missing that attribute. AttributeError: '_FakeStack' object has no attribute '__ident_func__'

update Flask-SQLAlchemy works for me. ( the solution I looked at StackOverFlow)
pip install Flask-SQLAlchemy==2.5.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants