From 0dbec94374b54460130f8d39f01a7091bc9014cc Mon Sep 17 00:00:00 2001 From: Florez Ospina Juan Felipe Date: Thu, 19 Sep 2024 15:47:11 +0200 Subject: [PATCH] Fixed instrument_dir estimation to be bottom up, ie, based on path to file. Otherwise, it does not work when dima used as submodule --- instruments/readers/g5505_text_reader.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/instruments/readers/g5505_text_reader.py b/instruments/readers/g5505_text_reader.py index 62c558c..d127202 100644 --- a/instruments/readers/g5505_text_reader.py +++ b/instruments/readers/g5505_text_reader.py @@ -17,12 +17,11 @@ def read_txt_files_as_dict(filename: str, instruments_dir: str = None, work_with # If instruments_dir is not provided, use the default path relative to the module directory if not instruments_dir: # Assuming the instruments folder is one level up from the source module directory - #module_dir = os.path.dirname(__file__) - #instruments_dir = os.path.join(module_dir, '..', 'instruments') - instruments_dir = os.path.join(root_dir,'instruments') + module_dir = os.path.dirname(__file__) + instruments_dir = os.path.join(module_dir, '..') # Normalize the path (resolves any '..' in the path) - instrument_configs_path = os.path.abspath(os.path.join(instruments_dir,'readers/config_text_reader.yaml')) + instrument_configs_path = os.path.abspath(os.path.join(instruments_dir,'readers','config_text_reader.yaml')) with open(instrument_configs_path,'r') as stream: try: