From 5c79ee12338cbe780ffa0129b682187ef472cde2 Mon Sep 17 00:00:00 2001 From: Nhan Huynh Date: Sun, 22 Jan 2023 20:46:57 -0500 Subject: [PATCH] added appdirs code block (commented out) for use on O2 --- minerva_analysis/__init__.py | 10 ++++++++++ requirements.yml | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/minerva_analysis/__init__.py b/minerva_analysis/__init__.py index dc855d6c5..6cfc679b2 100644 --- a/minerva_analysis/__init__.py +++ b/minerva_analysis/__init__.py @@ -1,6 +1,7 @@ from flask import Flask from pathlib import Path from flask_sqlalchemy import SQLAlchemy +from appdirs import user_data_dir from numcodecs import compat_ext # Needed for pyinstaller from numcodecs import blosc # Needed for pyinstaller @@ -17,11 +18,20 @@ #centralizing path across app cwd_path = Path.cwd() +## uncomment block if not on O2 if getattr(sys, 'frozen', False): data_path = Path(Path(sys.executable).parent / 'data') multiprocessing.freeze_support() else: data_path = Path("minerva_analysis/data").resolve() + +## uncomment block if on O2 +# appname = "minerva_analysis" +# appauthor = "lsp" +# data_path = Path(user_data_dir(appname, appauthor)+'/data').resolve() +# if getattr(sys, 'frozen', False): +# multiprocessing.freeze_support() + # print('Data Path', str(data_path), str((data_path).resolve())) # Make the Data Path data_path.mkdir(parents=True, exist_ok=True) diff --git a/requirements.yml b/requirements.yml index 684215738..de48c9dc1 100644 --- a/requirements.yml +++ b/requirements.yml @@ -7,6 +7,7 @@ dependencies: - jinja2==3.0.3 - werkzeug==2.0.3 - itsdangerous==2.0.1 + - appdirs - flask-sqlalchemy - numpy - ome-types @@ -26,4 +27,3 @@ dependencies: - opencv-python==4.5.3.56 -