Commit b42745c3e7b01e34acf400317c870a40c3215914
1 parent
b08b6933
Exists in
dev
Fix config_pyros paths
Showing
2 changed files
with
21 additions
and
15 deletions
Show diff stats
CHANGELOG
src/core/pyros_django/dashboard/config_pyros.py
... | ... | @@ -4,8 +4,12 @@ import sys |
4 | 4 | import time |
5 | 5 | import pykwalify.core |
6 | 6 | from pykwalify.errors import SchemaError |
7 | -sys.path.append("../../../") | |
7 | + | |
8 | +sys.path.append(os.environ.get("PROJECT_ROOT_PATH", "../../../../")) | |
9 | + | |
8 | 10 | from vendor.guitastro.src.guitastro import FileNames |
11 | + | |
12 | + | |
9 | 13 | class ConfigPyros: |
10 | 14 | |
11 | 15 | def check_and_return_config(self, yaml_file: str, schema_file: str) -> dict: |
... | ... | @@ -32,7 +36,7 @@ class ConfigPyros: |
32 | 36 | time.sleep(0.5) |
33 | 37 | |
34 | 38 | c = pykwalify.core.Core(source_file=yaml_file, schema_files=[ |
35 | - self.config_path+"/"+schema_file]) | |
39 | + os.path.join(self.config_path, schema_file)]) | |
36 | 40 | return c.validate(raise_exception=True) |
37 | 41 | except SchemaError: |
38 | 42 | for error in c.errors: |
... | ... | @@ -80,8 +84,8 @@ class ConfigPyros: |
80 | 84 | return None |
81 | 85 | |
82 | 86 | def __init__(self, pyros_config_file): |
83 | - self.config_path = os.path.abspath(os.path.join( | |
84 | - os.environ.get("DJANGO_PATH"), "../../../config/")) | |
87 | + self.config_path = os.path.join( | |
88 | + os.environ.get("PROJECT_ROOT_PATH", "../../../") , "config/") | |
85 | 89 | if pyros_config_file is None: |
86 | 90 | pyros_config_file = "config_pyros_default.yml" |
87 | 91 | self.pyros_config = self.read_and_check_config_file(pyros_config_file) |
... | ... | @@ -100,19 +104,20 @@ class ConfigPyros: |
100 | 104 | self.fn = fn |
101 | 105 | def main(): |
102 | 106 | os.environ["DJANGO_PATH"] = "../../src/core/pyros_django" |
103 | - cp = ConfigPyros("config_pyros.yml") | |
107 | + os.environ["PROJECT_ROOT_PATH"] = "../../../../" | |
108 | + cp = ConfigPyros(os.path.join(os.environ["PROJECT_ROOT_PATH"], "config", "config_pyros_default.yml")) | |
104 | 109 | cp.fn.fcontext = "pyros_seq" |
105 | 110 | print(cp.fn) |
106 | - file_fullname = "../../data/sequences_pickle/P1/20230319/16.p" | |
107 | - param = cp.fn.naming_get(file_fullname) | |
108 | - print(param) | |
109 | - cp.fn.fname = cp.fn.naming_set(param) | |
110 | - print(cp.fn.fname) | |
111 | - #cp.fn.subdir = cp.fn.subdir_from_filename(file_fullname) | |
112 | - print(type(cp.fn.fname)) | |
113 | - out_fullname = cp.fn.join() | |
114 | - print(os.getcwd()) | |
115 | - print(out_fullname) | |
111 | + # file_fullname = "../../data/sequences_pickle/P1/20230319/16.p" | |
112 | + # param = cp.fn.naming_get(file_fullname) | |
113 | + # print(param) | |
114 | + # cp.fn.fname = cp.fn.naming_set(param) | |
115 | + # print(cp.fn.fname) | |
116 | + # #cp.fn.subdir = cp.fn.subdir_from_filename(file_fullname) | |
117 | + # print(type(cp.fn.fname)) | |
118 | + # out_fullname = cp.fn.join() | |
119 | + # print(os.getcwd()) | |
120 | + # print(out_fullname) | |
116 | 121 | if __name__ == "__main__": |
117 | 122 | |
118 | 123 | main() |
119 | 124 | \ No newline at end of file | ... | ... |