-
Notifications
You must be signed in to change notification settings - Fork 42
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
Using Dynaconf results in TypeError: __name__ must be set to a string object error #57
Comments
Please provide full stack trace and versions of the relevant software you're using, the exception itself provides almost no information. |
sorry for lacking info. here's the stack trace:
|
if I run |
Thanks. I have to repeat my request for you to provide full stack trace (including full file paths and package names, the trace you pasted is modified; you can mask some private/confidential details but not this much, I'd like to know what I'm dealing with and for the general structure to be intact) and versions of the relevant software (Python, Flask, Flask-Injector, Injector, Flask-Dynaconf). |
sorry it took so long to answer, I was busy on other projects. here's an example project I set up: https://github.com/ahmadalli/flask-dynaconf-inject when I run it with this commands, it fails with the same error: pipenv shell
export FLASK_APP=microblog
flask run |
The same for me, using |
I'm having the same issue. The problem seems to be that the current logic assumes that everything that has the Note that as an (admittedly brittle) workaround, you can access Full sample code for reproduction: from dynaconf import FlaskDynaconf
from flask import Flask
from flask_injector import FlaskInjector
app = Flask(__name__)
FlaskDynaconf(app)
FlaskInjector(app) $ python --version
Python 3.8.2 requirements.txt
Stacktrace: Traceback (most recent call last):
File "C:/Users/User/PycharmProjects/test_me/app.py", line 8, in <module>
FlaskInjector(app)
File "C:\Users\User\PycharmProjects\test_me\venv\lib\site-packages\flask_injector\__init__.py", line 327, in __init__
process_dict(container, injector)
File "C:\Users\User\PycharmProjects\test_me\venv\lib\site-packages\flask_injector\__init__.py", line 380, in process_dict
d[key] = wrap_fun(value, injector)
File "C:\Users\User\PycharmProjects\test_me\venv\lib\site-packages\flask_injector\__init__.py", line 66, in wrap_fun
return wrap_function(fun, injector)
File "C:\Users\User\PycharmProjects\test_me\venv\lib\site-packages\flask_injector\__init__.py", line 94, in wrap_function
def wrapper(*args: Any, **kwargs: Any) -> Any:
File "C:\Users\User\AppData\Local\Programs\Python\Python38\lib\functools.py", line 54, in update_wrapper
setattr(wrapper, attr, value)
TypeError: __name__ must be set to a string object |
Hi
If I Add
FlaskDynaconf(app)
beforeFlaskInjector(app=app, modules=[init_inject])
, it'll result inTypeError: __name__ must be set to a string object
this is the dynaconf project: https://dynaconf.readthedocs.io/en/latest/guides/flask.html
The text was updated successfully, but these errors were encountered: