Skip to content
Snippets Groups Projects
Commit b176fed0 authored by Lan Dam's avatar Lan Dam
Browse files

Merge branch 'i69-dbpath-work-everywhere' into 'master'

Function to modify dbConf['dbpath'] to absolute path

See merge request !209
parents 0c58cb14 a1b7fcaf
No related branches found
No related tags found
1 merge request!209Function to modify dbConf['dbpath'] to absolute path
Pipeline #3192 passed with stage
in 3 minutes and 16 seconds
import re
import os
from pathlib import Path
from sohstationviewer.conf.constants import (WF_1ST, WF_2ND, WF_3RD)
"""
......@@ -42,3 +44,20 @@ dbConf = {
"If D is not defined, dots won't be displayed.\n"
"If L is not defined, lines will be plotted with color G")}
}
def modify_db_path():
"""
Modify dbpath to absolute path.
This function is called in case database needs to be used when the working
directory is a sub folder of root, sohstationviewer/. The following lines
need to be added:
from sohstationviewer.conf.dbSettings import modify_db_path
modify_db_path()
"""
global dbConf
current_file_path = os.path.abspath(__file__)
root = Path(current_file_path).parent.parent
db_path = [x for x in root.glob('**/soh.db')][0]
dbConf['dbpath'] = db_path.as_posix()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment