From 5a46011332bbb5252b14d5cc1828772b09c3225e Mon Sep 17 00:00:00 2001 From: gregor herrmann Date: Thu, 5 Jul 2018 19:28:21 +0200 Subject: [PATCH] try to be a bit more clever in finding our libraries appending '..' to sys.path only works when seepark_web.py is started from its directory, otherwise we get: flask.cli.NoAppException: While importing "seepark_web", an ImportError was raised: Traceback (most recent call last): File "/usr/lib/python3/dist-packages/flask/cli.py", line 235, in locate_app __import__(module_name) File "/home/gregoa/src/toastfreeware/seepark/web/seepark_web.py", line 14, in from seeparklib.openweathermap import openweathermap_json, OpenWeatherMapError ModuleNotFoundError: No module named 'seeparklib' --- web/seepark_web.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/web/seepark_web.py b/web/seepark_web.py index 065e3f2..f53585e 100644 --- a/web/seepark_web.py +++ b/web/seepark_web.py @@ -10,7 +10,9 @@ import flask.json from flask_sqlalchemy import SQLAlchemy -sys.path.append('..') +app_path = os.path.dirname(os.path.realpath(__file__)) +lib_path = os.path.join(cur_path, '..') +sys.path.append(lib_path) from seeparklib.openweathermap import openweathermap_json, OpenWeatherMapError -- 2.47.3