From 3ddffdfba4fb20684953fcb41352771e0d46a015 Mon Sep 17 00:00:00 2001 From: Debanjum Singh Solanky Date: Fri, 9 Sep 2022 07:15:28 +0300 Subject: [PATCH 1/2] Create config directory before setting up logging to file under it - The logging to file code expects the config directory to already be setup - But parent directory of config file was being set up later in code - This resulted in app start failing with ~/.khoj dir does not exist error --- src/main.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main.py b/src/main.py index 72a05884..6fbcd035 100644 --- a/src/main.py +++ b/src/main.py @@ -63,6 +63,9 @@ def run(): args = cli(state.cli_args) set_state(args) + # Create app directory, if it doesn't exist + state.config_file.parent.mkdir(parents=True, exist_ok=True) + # Setup Logger if args.verbose == 0: logger.setLevel(logging.WARN) From 588f5989493c72b3d46d46c584bd459f94524804 Mon Sep 17 00:00:00 2001 From: Debanjum Singh Solanky Date: Fri, 9 Sep 2022 07:18:05 +0300 Subject: [PATCH 2/2] Pass empty list of `input_files' to FileBrowser on first run - Default config has `input_files' set to None - This was being passed to `FileBrowser' on Initialization - But `FileBrowser' expects `content_files' of list type, not None - This resulted in an unexpected NoneType failure --- src/interface/desktop/main_window.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/interface/desktop/main_window.py b/src/interface/desktop/main_window.py index 97bbb54a..25287d27 100644 --- a/src/interface/desktop/main_window.py +++ b/src/interface/desktop/main_window.py @@ -92,7 +92,7 @@ class MainWindow(QtWidgets.QMainWindow): search_type_layout = QtWidgets.QVBoxLayout(search_type_settings) enable_search_type = SearchCheckBox(f"Search {search_type.name}", search_type) # Add file browser to set input files for given search type - input_files = FileBrowser(file_input_text, search_type, current_content_files) + input_files = FileBrowser(file_input_text, search_type, current_content_files or []) # Set enabled/disabled based on checkbox state enable_search_type.setChecked(current_content_files is not None and len(current_content_files) > 0)