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

AttributeError: 'NoneType' object has no attribute 'is_caching_enabled' #885

Open
Arcturus122 opened this issue Jan 26, 2021 · 2 comments
Open

Comments

@Arcturus122
Copy link

Good Morning !

Arctic Version

1.79.4

Arctic Store

not needed because only at connection and list_libraries() level

Platform and version

PRETTY_NAME="Debian GNU/Linux 10 (buster)"
NAME="Debian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

Description of problem and/or code sample that reproduces the issue

python code app.py

from flask import Flask
from flask import request, jsonify
from random import sample
from arctic import Arctic

server = Flask(__name__)

conn = Arctic(
    'mongodb://******:******@<IP ADRESS>:27017/?authSource=admin')


def run_request():
    index = int(request.json['index'])
    list = ['red', 'green', 'blue', 'yellow', 'black']
    return list[index]


@server.route('/', methods=['GET', 'POST'])
def hello_world():
    if request.method == 'GET':
        return 'it works !'
    else:
        return run_request()


@server.route('/libraries')
def libraries():
    return jsonify(
        status=200,
        message=conn.list_libraries()
    )

python code wsgi.py

from app import server

if __name__ == "__main__":
    server.run(host='0.0.0.0', port=8000, debug=True)

my mongodb is in a docker and I am using directly root credentials to connect with the Arctic object in order to debug

when requesting the '/' route, there is no problem I get the 'It works !' message but when requesting the '/libraries' route
conn.list_libraries() return this error :

[2021-01-26 07:36:13,324] ERROR in app: Exception on /libraries [GET]
flask_app | Traceback (most recent call last):
flask_app | File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 2447, in wsgi_app
flask_app | response = self.full_dispatch_request()
flask_app | File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1952, in full_dispatch_request
flask_app | rv = self.handle_user_exception(e)
flask_app | File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1821, in handle_user_exception
flask_app | reraise(exc_type, exc_value, tb)
flask_app | File "/usr/local/lib/python3.6/site-packages/flask/_compat.py", line 39, in reraise
flask_app | raise value
flask_app | File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1950, in full_dispatch_request
flask_app | rv = self.dispatch_request()
flask_app | File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1936, in dispatch_request
flask_app | return self.view_functionsrule.endpoint
flask_app | File "/usr/src/flask_app/app.py", line 29, in libraries
flask_app | message=conn.list_libraries()
flask_app | File "/usr/local/lib/python3.6/site-packages/arctic/arctic.py", line 206, in list_libraries
flask_app | return self._list_libraries_cached(newer_than_secs) if self.is_caching_enabled() else self._list_libraries()
flask_app | File "/usr/local/lib/python3.6/site-packages/arctic/arctic.py", line 198, in is_caching_enabled
flask_app | return self._cache.is_caching_enabled(ENABLE_CACHE)
nginx | 77.198.248.231 - - [26/Jan/2021:07:36:13 +0000] "GET /libraries HTTP/1.1" 500 290 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.2 Safari/605.1.15" "-"
flask_app | AttributeError: 'NoneType' object has no attribute 'is_caching_enabled'

Many thanks in advance !

Arcturus122

@shashank88
Copy link
Contributor

I was meaning to take a look at this, leave it with me for now, will take a look over the weekend.

@shashank88
Copy link
Contributor

#892 should fix it @Arcturus122

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

2 participants